tag:blogger.com,1999:blog-64500975847893231002024-03-05T03:00:15.866-06:00Tonejito= ^ . ^ =Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.comBlogger77125tag:blogger.com,1999:blog-6450097584789323100.post-60391912492270194082016-05-12T11:25:00.001-05:002016-05-12T11:34:56.329-05:00Linux mirrors for ttylinux and RIPLinuxHello
<br />
<div style="text-align: justify;">
Without any doubt I'm a Debian user, I really like its stability for server and desktop machines. However, I found myself amused back in 2010 when I found out about ttylinux, a small ISO of about 100MB with ssh, http and firewall support.
</div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUHkGREdRk_CymymkwnIjmPNky6zlZ3QuamyJfL1v6pJ_8mxAjrMjU6viJCwBdXgClfpJoEsrvuD-oRiH0zxsuQK6Khe75J9ftYQ2qL7OvR7uM7Qj4EVTxVpF2O6TOOBVh-9rtslTHlnA/s1600/ttylinux-boot.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img alt="ttylinux boot screen" border="0" height="110" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUHkGREdRk_CymymkwnIjmPNky6zlZ3QuamyJfL1v6pJ_8mxAjrMjU6viJCwBdXgClfpJoEsrvuD-oRiH0zxsuQK6Khe75J9ftYQ2qL7OvR7uM7Qj4EVTxVpF2O6TOOBVh-9rtslTHlnA/s200/ttylinux-boot.png" title="ttylinux boot screen" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">ttylinux boot screen</td></tr>
</tbody></table>
<br />
<div style="text-align: justify;">
With an small footprint, compatibility with older CPU and low memory support I became a occasional user of ttylinux to quickly boot it on bare metal from a CD-RW and say "Hey, this machine can run Linux". With the advent of virtualization I choose to boot ttylinux before anything else in order to check that my virtualization environment (VirtualBox, Xen, VMware or whatever else) was fully working or at least functional.
</div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjMUdaFc3SDOuwcb7fEGAchpRBQ4OP-JzjUavBgG8rlclyu1rxgHwOj0G5wGQfwzVQiH_-6DSnwjfCtvPhWJx7a7xaLHReaTjg_-9vf4Pp_JdgJQvp67uWQRdSTkXNVft8DmqQUZ6CCy4/s1600/ttylinux-login.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img alt="ttylinux login screen" border="0" height="110" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjMUdaFc3SDOuwcb7fEGAchpRBQ4OP-JzjUavBgG8rlclyu1rxgHwOj0G5wGQfwzVQiH_-6DSnwjfCtvPhWJx7a7xaLHReaTjg_-9vf4Pp_JdgJQvp67uWQRdSTkXNVft8DmqQUZ6CCy4/s200/ttylinux-login.png" title="ttylinux login screen" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">ttylinux login screen</td></tr>
</tbody></table>
<br />
<div style="text-align: justify;">
In the same year 2010 <a href="https://twitter.com/roadmr">@RoadMr</a> talked about RIPLinux and I quickly downloaded the ISO image, it was bigger, around 150 MB but it had many utilities and both a 32 and 64 bit kernels. The main purpose of the distribution was to rescue data, hence its name "(R)ecovery (I)s (P)ossible Linux"
</div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAaFC4Ztk7leNJidrevNUTK9EgbqREyBF1hZ-gt6onjcFgYRH8Dz049FHs3WnRsfH7NIAEchE3TCjASJKG5_HqklVdlYoZJBZvg4iYmcXCu2FGViaUIr5EpDRXpxNMl3Nu8ficj76UnTE/s1600/RIPLinux-boot.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img alt="RIPLinux boot screen" border="0" height="110" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAaFC4Ztk7leNJidrevNUTK9EgbqREyBF1hZ-gt6onjcFgYRH8Dz049FHs3WnRsfH7NIAEchE3TCjASJKG5_HqklVdlYoZJBZvg4iYmcXCu2FGViaUIr5EpDRXpxNMl3Nu8ficj76UnTE/s200/RIPLinux-boot.png" title="RIPLinux boot screen" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">RIPLinux boot screen</td></tr>
</tbody></table>
<br />
<div style="text-align: justify;">
I didn't used the X utilities much but I like the fact that you could perform rsync, sftp and even reset Windows passwords from the SAM hive, it even included the ntfs-3g which enables read-write support on NTFS filesystems. I found myself amused again and I added another CD-RW to my toolset.
</div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKJV2YcEC6kdgOLTAHKa_67rCCFeJ4vbnM-n7j7_RFrYQsuBEvY5Sfz92OjJzQavBLx1usHRyUaLGeTVahuL0RVrF_iZ53IN-SYpd2gDlHQHoVgDT3wfCtdFlYMCbaFC1CcOJZk785Htk/s1600/RIPLinux-login.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img alt="RIPLinux login screen" border="0" height="110" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKJV2YcEC6kdgOLTAHKa_67rCCFeJ4vbnM-n7j7_RFrYQsuBEvY5Sfz92OjJzQavBLx1usHRyUaLGeTVahuL0RVrF_iZ53IN-SYpd2gDlHQHoVgDT3wfCtdFlYMCbaFC1CcOJZk785Htk/s200/RIPLinux-login.png" title="RIPLinux login screen" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">RIPLinux login screen</td></tr>
</tbody></table>
<br />
<div style="text-align: justify;">
It was terrible for me when I found out the last month that the ttylinux site was unreachable, I was trying to check two implementations I made, one with VirtualBox and another one with VMware. I quickly searched through the net and found various ISO images from current and past releases, the I found the <a href="http://sourceforge.net/projects/ttylinux-mirror/">ttylinux-mirror project on SourceForge</a> and commited to download the 2.2 GB 7z archive.
</div>
<br />
<div style="text-align: justify;">
Soon after I also realized about the RIPLinux website being unreachable too, this time I had no luck on finding a mirror archive until I found an exact copy on some Linux user group sites (thank you for mirroring :P). I downloaded the several copies and unified them on a single directory.
</div>
<br />
<div style="text-align: justify;">
This exercise lead me to the idea of making my own mirror for both distros and perhaps working on them on my little free time, I set up the web server, bought the domains and later on pointed them to the web server where the content was.
</div>
<br />
<div style="text-align: justify;">
I even set up two repositories on github to preserve the web sites because the <b>djerome</b> ttylinux github repositories simply vanished as well as the google group. If anyone has a copy of the archives, post a comment and I will make the archive available on the web.
</div>
<br />
<ul>
<li><a href="http://ttylinux.info/">http://ttylinux.info/</a></li>
<li><a href="http://riplinux.info/">http://riplinux.info/</a></li>
</ul>
<br />
<b>Chop wood, carry water.</b>
<br />
<pre>--
= ^ . ^ =
</pre>
<div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com1tag:blogger.com,1999:blog-6450097584789323100.post-92145126140402645652016-04-26T10:04:00.002-05:002016-04-26T10:04:49.689-05:00Logwatch weekly reportsI realy like Logwatch <a href="https://www.blogger.com/blogger.g?blogID=6450097584789323100#_1">[1]</a> for analyzing server log entries, however having an email from each host every morning could be an issue when hosts > 10. So I found a way to tell logwatch "analyze the logs for the past week" thanks to the Perl module for date manipulation <a href="https://www.blogger.com/blogger.g?blogID=6450097584789323100#_2">[2]</a><a href="https://www.blogger.com/blogger.g?blogID=6450097584789323100#_3">[3]</a>.<br />
<br />
I posted the logwatch.conf on Github <a href="https://www.blogger.com/blogger.g?blogID=6450097584789323100#_4">[4]</a> and I have tested it on the following distros:<br />
<ul>
<li>Debian 6 <i>squeeze</i>, 7 <i>wheezy</i> and 8 <i>jessie</i></li>
<li>Ubuntu 12.04 LTS <i>precise</i> and 14.04 LTS <i>trusty</i></li>
<li>CentOS 6 and 7</li>
</ul>
<div>
<script src="https://gist.github.com/tonejito/530dff2904fa05304da6b825130f428d.js"></script>
References:</div>
<br />
<br />
<ol>
<li><a href="https://sourceforge.net/projects/logwatch/" id="_1" name="_1">https://sourceforge.net/projects/logwatch/</a></li>
<li><a href="http://logwatch.org/pipermail/logwatch/2007-October/001584.html" id="_2" name="_2">http://logwatch.org/pipermail/logwatch/2007-October/001584.html</a></li>
<li><a href="http://primozverdnik.com/2011/05/logwatch-once-a-week-is-enough/" id="_3" name="_3">http://primozverdnik.com/2011/05/logwatch-once-a-week-is-enough/</a></li>
<li><a href="https://gist.github.com/tonejito/530dff2904fa05304da6b825130f428d" id="_4" name="_4">https://gist.github.com/tonejito/530dff2904fa05304da6b825130f428d</a></li>
</ol>
<br />
Cheers!
<br />
<pre>--
= ^ . ^ =
</pre>
<div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com0tag:blogger.com,1999:blog-6450097584789323100.post-29503820697468251042015-10-15T18:43:00.001-05:002015-10-15T18:43:06.959-05:00Logwatch + MailGunI really like the way Logwatch works but I hate when I can't properly send mail due to reverse DNS restrictions, based on this post <a href="https://www.blogger.com/blogger.g?blogID=6450097584789323100#_1">[1]</a> I came with the idea of leveraging the power of MailGun in order to send Logwatch email notifications and it went successfuly.<br />
<br />
In the logwatch main configuration file (/etc/logwatch/conf/logwatch.conf) on Debian, change the following:<br />
<br />
<ol>
<li>comment out the sendmail line</li>
<br />
<code># mailer = "/usr/sbin/sendmail -t"</code>
<br />
<br />
<li>add a line to use our custom mailgun mailer script</li>
<br />
<br />
<code>mailer = "/usr/local/sbin/mailgun"</code>
<br />
<br />
</ol>
After changing the values, you can run a test with the following command line<br />
<br />
<code>/etc/cron.daily/00logwatch</code>
<br />
<br />
The mailgun shell script can be (literally) checked out here <a href="https://www.blogger.com/blogger.g?blogID=6450097584789323100#_2">[2]</a>.<br />
<br />
<script src="https://gist.github.com/tonejito/1a50b4d8b181393ebf77.js"></script>
<br />
<ol>
<li><a href="http://blog.thinkingcapstudios.net/2012/07/installing-lemonstand-on-ubuntu-part-2/" name="_1">http://blog.thinkingcapstudios.net/2012/07/installing-lemonstand-on-ubuntu-part-2/</a></li>
<li><a href="https://gist.github.com/tonejito/1a50b4d8b181393ebf77" name="_2">https://gist.github.com/tonejito/1a50b4d8b181393ebf77</a></li>
</ol>
<br />
<br />
<pre>--
= ^ . ^ =
</pre>
<div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com0tag:blogger.com,1999:blog-6450097584789323100.post-84351840302408354402015-07-21T11:17:00.003-05:002015-07-21T11:25:51.500-05:00XenServer and NTPAfter spending hours and hours trying to set up the timezone and hwclock via ntp on a Debian 7.8 Wheezy VM on XenServer 6.5 I gave up and ended up setting the timezone to UTC because the clock was only displayed correctly if the tz was UTC (damn bad).<br />
<br />
I came up this morning with the idea of checking the time of the XenServer dom0 to see if at least the physical box had its time ok. Big was my surprise when I realized the dom0's time was also skewed just like in the VMs as stated on [1]<br />
<br />
I restarted the NTP daemon because I configured it to point to the ntp pool when setting up the box. Big was my surprise when I realized the NTP daemon was starting, but the synchronization was failed:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">[root@xenserver ~]# service ntpd restart<br />Shutting down ntpd: [ OK ]<br />ntpd: Synchronizing with time server: [FAILED]<br />Starting ntpd: [ OK ]</span><br />
<br />
I restarted the NTP daemon on the old fashioned way, since the XenServer 6.5 is based on CentOS, that shouldn't be an issue.<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">[root@xenserver ~]# /bin/bash -vx /etc/init.d/ntpd restart</span><br />
<br />
After some output, I realized the script runs ntpdate to get the synchronization done like this:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">ntpd: Synchronizing with time server: + /sbin/ntpdate -U ntp -s -b 0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org</span><br />
<br />
After running the command with debug and verbose flags I realized that there was something wrong with using an privileged port and dropping privileges to the ntp user, so turning on the -u flag on /etc/sysconfig/ntpd was the right way to do it. [2] [3]<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">[root@xenserver ~]# cat /etc/sysconfig/ntpd <br /># Drop root to id 'ntp:ntp' by default.<br />OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid -x"<br /><br /># Set to 'yes' to sync hw clock after successful ntpdate<br />SYNC_HWCLOCK=no<br /><br /># Additional options for ntpdate<br />NTPDATE_OPTIONS="-u"</span><br />
<br />
After the change everything went smoothly:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">[root@xenserver ~]# service ntpd restart<br />Shutting down ntpd: [ OK ]<br />ntpd: Synchronizing with time server: [ OK ]<br />Starting ntpd: [ OK ]</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">--</span><br />
<span style="font-family: "Courier New",Courier,monospace;">= ^ . ^ =</span><br />
<br />
[1] http://docs.vmd.citrix.com/XenServer/6.0.0/1.0/en_gb/guest.html#time_linux<br />
[2] https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/sect-Date_and_Time_Configuration-Command_Line_Configuration-Network_Time_Protocol.html<br />
[3] http://linux.die.net/man/8/ntpdate<div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com0tag:blogger.com,1999:blog-6450097584789323100.post-81497191345661026192015-07-02T18:21:00.000-05:002015-07-02T18:21:10.193-05:00Bulk enable servers in phpMyAdminPut this in config.inc.php in phpMyAdmin if you are connecting to a bunch of servers (like I do xD).<br />
<br />
<script src="https://gist.github.com/tonejito/bf11f400729a283ae569.js"></script>
<br />
<code>
--<br />
= ^ . ^ =<br />
</code>
<div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com0tag:blogger.com,1999:blog-6450097584789323100.post-55952669279871170262014-06-04T20:57:00.001-05:002014-06-04T20:57:09.463-05:00VMware Player certificate error in LinuxWhen installing a virtual machine and attempting to install VMware Tools on it it will fail complaining about being unable to check a certificate and display an error message.<br />
<br />
<pre>A certificate error occurred for the update server. Check your Internet settings or contact your system administrator</pre>
<br />
I searched on the internet and foud this page <a href="https://www.blogger.com/blogger.g?blogID=6450097584789323100#_1">[1]</a> and I modified the instructions as shown below.<br />
<br />
<div class="separator" style="clear: both; margin-left: auto; margin-right: auto; text-align: center;">
This is the VMware version I'm using:
</div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3f93V6_v0KWqY3QGmqYrt0Q8Q3j45zNbIDZFLDV3m9JkbA_j4Qb5FhF7Hlo6Q_E_cnjXUTd_nkjof6tS18WrDXbjktMAHdVd-R8R5SfCLTpiAMpeFQqS6jlKipPHytPDXmD2NMIfGTsc/s1600/VMware-001-about.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3f93V6_v0KWqY3QGmqYrt0Q8Q3j45zNbIDZFLDV3m9JkbA_j4Qb5FhF7Hlo6Q_E_cnjXUTd_nkjof6tS18WrDXbjktMAHdVd-R8R5SfCLTpiAMpeFQqS6jlKipPHytPDXmD2NMIfGTsc/s320/VMware-001-about.png" /></a><br />
<br />
<div class="separator" style="clear: both; margin-left: auto; margin-right: auto; text-align: center;">
This is the error message
</div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhg0xFuPR-42pJiez9sZypjdp8mJ6Gqn5-9XiTgPefyZDeb5k1q-oJheKfklVxoHFEmk4g3aTZj75zwQCTmYSuu_NKX9tCZo99a-cOtNOZq3O-CPhTdA47-_IsdLgt_cMkcDCEauqEK8qM/s1600/VMware-002-certificate-error.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhg0xFuPR-42pJiez9sZypjdp8mJ6Gqn5-9XiTgPefyZDeb5k1q-oJheKfklVxoHFEmk4g3aTZj75zwQCTmYSuu_NKX9tCZo99a-cOtNOZq3O-CPhTdA47-_IsdLgt_cMkcDCEauqEK8qM/s320/VMware-002-certificate-error.png" /></a><br />
<br />
<div class="separator" style="clear: both; margin-left: auto; margin-right: auto; text-align: center;">
This is the normal application dialog appearing after the issue has been fixed:
</div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgY15EhKYv06Mq-hsaEtCDTwlHFOYhjhCpNlAhbbCVWgwIN0HEEqV3nb3f18T_etGaMC0u_k7QEij0pPpRblbpAww6Mk9Z483X5gkwSJ1BxLfNprn4HJd50RxKDaHzP22UfhWl3fj5Yei0/s1600/VMware-004-solved.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgY15EhKYv06Mq-hsaEtCDTwlHFOYhjhCpNlAhbbCVWgwIN0HEEqV3nb3f18T_etGaMC0u_k7QEij0pPpRblbpAww6Mk9Z483X5gkwSJ1BxLfNprn4HJd50RxKDaHzP22UfhWl3fj5Yei0/s320/VMware-004-solved.png" /></a><br />
<br />
<div class="separator" style="clear: both; margin-left: auto; margin-right: auto; text-align: center;">
The dialog when downloading the VMware Tools ISO image:
</div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0t1iBGXqCyMd7IIDP9AfFZqJC7NPp5OIJidh-hh-OFpmHcqjZxLkj8Wps7ye51CvZ5QgfkgP2ZbTZJ6gRoNun-khJ3qaEq86xaHnkugv67mrsaxzP0nvTPdYgkVjWQE_8MYtyRaq73fE/s1600/VMware-003-downloading.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0t1iBGXqCyMd7IIDP9AfFZqJC7NPp5OIJidh-hh-OFpmHcqjZxLkj8Wps7ye51CvZ5QgfkgP2ZbTZJ6gRoNun-khJ3qaEq86xaHnkugv67mrsaxzP0nvTPdYgkVjWQE_8MYtyRaq73fE/s320/VMware-003-downloading.png" /></a><br />
<br />
<div class="separator" style="clear: both; margin-left: auto; margin-right: auto; text-align: center;">
After the ISO has been downloaded it shows the instructions for installing.
</div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRmgl7gcAPAnsDZ7j6itq7oiCYyklKqhOIZjkyKGzOTOYD-smm3xnZw4kNGz7dodEiDrZK5wKeDcmbWYrTWOMF3wLAS2EJ3QSZDODrSJKT0htRpvCy6Wbode66XL4sdn2EvM0ZnXA25QE/s1600/VMware-005-installing.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRmgl7gcAPAnsDZ7j6itq7oiCYyklKqhOIZjkyKGzOTOYD-smm3xnZw4kNGz7dodEiDrZK5wKeDcmbWYrTWOMF3wLAS2EJ3QSZDODrSJKT0htRpvCy6Wbode66XL4sdn2EvM0ZnXA25QE/s320/VMware-005-installing.png" /></a><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
As always the patch on github
<br />
<script src="https://gist.github.com/tonejito/2bd654703166d7536c98.js"></script>
<br />
Related resources
<br />
<ol>
<li><a href="http://www.fedoraforum.org/forum/showthread.php?t=240980" name="_1">http://www.fedoraforum.org/forum/showthread.php?t=240980</a></li>
</ol>
<br />
<code>
--<br />
= ^ . ^ =<br />
</code><div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com1tag:blogger.com,1999:blog-6450097584789323100.post-34521594479222215182014-05-28T23:59:00.001-05:002014-05-29T00:00:50.754-05:00./hibernate.shMy Debian Jessie hibernation option is somehow broken and I needed a quick way to set the laptop to hibernate when I'm on the road. As always, the github gist is below for both <b>the script</b> and <b>the sudo config</b>:
<br/><br/>
<script src="https://gist.github.com/tonejito/4230da9a0b615116c923.js"></script>
<br/>
<code>
--<br />
= ^ . ^ =<br />
</code>
<br />
<div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com0tag:blogger.com,1999:blog-6450097584789323100.post-66312866593944495452014-05-26T23:43:00.000-05:002014-05-28T23:47:00.023-05:00Drupal 2 Pgpass - Convert Drupal 6 pgsql db_url to .pgpass format and set permissionsI needed to <i>automagically</i> connect to the database of some drupal 6 instances, so I wrote this script to convert the settings.php <a href="#_1">[1]</a> $db_url <a href="#_2">[2]</a> into the ~/.pgpass <a href="#_3">[3]</a> file, remember to also set the apropriate permissions (0600) and also be sure to own the file, otherwise it won't work.
<br/>
<script src="https://gist.github.com/tonejito/cc5d2c8994673052e13d.js"></script>
<br/>
Related resources
<ol>
<li><a name="_1" href="https://api.drupal.org/api/drupal/sites!default!default.settings.php/6">https://api.drupal.org/api/drupal/sites!default!default.settings.php/6</a></li>
<li><a name="_2" href="https://api.drupal.org/api/drupal/developer!globals.php/global/db_url/6">https://api.drupal.org/api/drupal/developer!globals.php/global/db_url/6</a></li>
<li><a name="_3" href="https://wiki.postgresql.org/wiki/Pgpass">https://wiki.postgresql.org/wiki/Pgpass</a></li>
</ol>
<br />
<code>
--<br />
= ^ . ^ =<br />
</code>
<br />
<div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com0tag:blogger.com,1999:blog-6450097584789323100.post-36503949065291867022014-03-10T00:02:00.001-06:002014-03-10T00:05:54.119-06:00Automatically download and gpg-verify running Linux kernel sourceAutomates the download kernel source and verify proccees stated on the official <a name="_1" href="https://www.kernel.org/signature.html">kernel.org</a></li> page <a href="#_1">[1]</a>
<br/>
<a href="https://gist.github.com/tonejito/9460148">gist @Github</a>.
<br/>
<script src="https://gist.github.com/tonejito/9460148.js"></script>
<br/>
Related resources
<ol>
<li><a name="_1" href="https://www.kernel.org/signature.html">https://www.kernel.org/signature.html</a></li>
</ol>
<br />
<code>
--<br />
= ^ . ^ =<br />
</code>
<br />
<div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com0tag:blogger.com,1999:blog-6450097584789323100.post-52725275108751995032014-03-05T02:51:00.000-06:002014-03-05T02:53:26.618-06:00Apache httpd configuration sectionsTo understand how Apache httpd apply configuration blocks.
<a href="https://gist.github.com/tonejito/9363566">gist @Github</a>.
<br/>
<script src="https://gist.github.com/tonejito/9363566.js"></script>
<br/>
Related resources
<ol>
<li><a href="http://httpd.apache.org/docs/2.2/sections.html">http://httpd.apache.org/docs/2.2/sections.html</a></li>
</ol>
<br />
<code>
--<br />
= ^ . ^ =<br />
</code>
<br />
<div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com0tag:blogger.com,1999:blog-6450097584789323100.post-48558879153932506582014-03-05T02:44:00.001-06:002014-03-05T02:44:08.434-06:00Apache httpd configuration file and directory structureMight be handy when working with different Linux distributions.
<br/>
I also created a <a href="https://gist.github.com/tonejito/9363481">gist @Github</a>.
<br/>
<script src="https://gist.github.com/tonejito/9363481.js"></script>
<br/>
<br />
<code>
--<br />
= ^ . ^ =<br />
</code>
<br />
<div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com0tag:blogger.com,1999:blog-6450097584789323100.post-22282103233267402862014-03-05T02:02:00.000-06:002014-03-05T02:02:23.919-06:00Apache Security Settings - /etc/apache2/conf.d/securityCommon Apache httpd security settings to prevent information disclosure. This file must be placed under:
<br/>
<code>/etc/apache2/conf.d/security</code>
<br/>
I also created a <a href="https://gist.github.com/tonejito/9362991">gist @Github</a>.
<br/>
<script src="https://gist.github.com/tonejito/9362991.js"></script>
Related resources
<ol>
<li><a href="http://httpd.apache.org/docs/2.2/">http://httpd.apache.org/docs/2.2/</a></li>
</ol>
<br />
<code>
--<br />
= ^ . ^ =<br />
</code>
<br />
<div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com0tag:blogger.com,1999:blog-6450097584789323100.post-74427116988547179102014-03-05T00:55:00.000-06:002014-03-05T00:55:12.767-06:00Apache httpd debug mode on Debian GNU/LinuxI use this script most of the times I'm debugging Apache-specific issues on Debian GNU/Linux.
I also created a <a href="https://gist.github.com/tonejito/9362386">gist @Github</a>.
<br/>
<script src="https://gist.github.com/tonejito/9362386.js"></script>
<br/>
Related resources
<ol>
<li><a href="http://httpd.apache.org/docs/2.2/">http://httpd.apache.org/docs/2.2/</a></li>
</ol>
<br />
<code>
--<br />
= ^ . ^ =<br />
</code>
<br />
<div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com2tag:blogger.com,1999:blog-6450097584789323100.post-33283747611169963432014-02-17T12:23:00.000-06:002014-03-05T01:31:56.761-06:00Download and display SSL certificate validity dates issuer and subjectPretty handy to check certificate validity dates.
<br/>
I also created a <a href="https://gist.github.com/tonejito/9362715">gist @Github</a>.
<br/>
<script src="https://gist.github.com/tonejito/9362715.js"></script>
<br />
<code>
--<br />
= ^ . ^ =<br />
</code>
<br />
<div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com0tag:blogger.com,1999:blog-6450097584789323100.post-77078107129425014472013-09-25T00:24:00.000-05:002013-09-25T00:24:04.937-05:00Launch VirtualBox VM and attach to serial console(like xm create -c)
I ported an older Mac OS X specific shell magic to GNU/Linux, see the <a href="/2012/05/virtualbox-serial-console-on-mac-os-x.html">old post</a> for details. I also created a <a href="https://gist.github.com/tonejito/6695404">@Github gist</a>.
<br/>
<script src="https://gist.github.com/tonejito/6695404.js"></script>
Related resources
<ol>
<li>http://www.telecom.otago.ac.nz/tele301/student_html/subnetfw-serial-terminal.html</li>
<li>http://howtoware.blogspot.mx/2012/01/oracle-vm-virtualbox-how-to-use-serial.html</li>
</ol>
<br />
<code>
--<br />
= ^ . ^ =<br />
</code>
<br />
<div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com0tag:blogger.com,1999:blog-6450097584789323100.post-61422391189474406032013-09-22T17:49:00.000-05:002014-05-20T17:46:40.892-05:00Optical media sizeI needed this, so I'm posting it here and also as a <a href="https://gist.github.com/tonejito/6664599">github gist</a>
<br />
<h3>Optical Media</h3>
<h4><b>W</b>rite <b>O</b>nce - <b>R</b>ead <b>M</b>any (a.k.a. Read-Only)</h4>
<p>The optical media industrial production systems work with a master media which is <i>printed</i> into the plastic discs using a thermal techinque transfering the zeroes (pits) and ones (lands) from the "negative" master to the final media, the types of media produced by this method are the following:</p>
<ul>
<li>CD-ROM</li>
<li>DVD-ROM</li>
<li>DVD-ROM Dual Layer</li>
<li>HD DVD-ROM</li>
<li>BD-ROM</li>
</ul>
<h5>One time write media</h5>
<p>This kind of media may be recorded <u>only</u> once by using a laser which marks the pits and lands in the spiral groove of the disc on the polycarbonate layer, the data is formatted most of the times according to the ISO9660 standard described on <a href="#1">[1]</a>, this kind of discs are refered with the following names:</p>
<ul>
<li>CD-R</li>
<li>DVD+R</li>
<li>DVD-R</li>
<li>DVD+R Dual Layer</li>
<li>DVD-R Dual Layer</li>
<li>BD-R</li>
</ul>
<h4><b>R</b>e<b>W</b>ritable Media</h4>
<p>The rewritable media, as its name implies, may be writed and erased many times, thanks to this feature a failed or incomplete burned disc may be erased and then reused rather than be disposed, the polycarbonate used can return to its normal state with the aid of a special laser beam. The designations for this media are as follows:</p>
<ul>
<li>CD-RW</li>
<li>DVD+RW</li>
<li>DVD-RW</li>
<li>BD-RE</li>
</ul>
<script src="https://gist.github.com/6664599.js"> </script>
Credits
<br />
<ol>
<li>http://en.wikipedia.org/wiki/DVD</li>
<li>http://jesusnjim.com/using-computers/optical-drives/media-capacities.html</li>
</ol>
<br />
<code>
--<br />
= ^ . ^ =<br />
</code><div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com0tag:blogger.com,1999:blog-6450097584789323100.post-81178724591154754882013-03-20T17:57:00.000-06:002013-03-20T17:57:04.267-06:00Get installed packages in Debian 64-bit<script src="https://gist.github.com/5209605.js"> </script>
<br />
<code>
--<br />
= ^ . ^ =<br />
</code>
<br /><div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com0tag:blogger.com,1999:blog-6450097584789323100.post-42368646683186093012013-03-07T17:31:00.002-06:002013-03-07T17:31:32.625-06:00Skype on Debian 7 "Wheezy" amd64Please comment if it worked for you<br />
<br />
Regards<br />
<br />
<script src="https://gist.github.com/5112844.js"> </script>
<br />
<code>
--<br />
= ^ . ^ =<br />
</code>
<br /><div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com4tag:blogger.com,1999:blog-6450097584789323100.post-63067653096059304472013-01-28T14:31:00.000-06:002013-01-28T14:31:44.180-06:00Find all users in groupI needed this, so I'm posting it<br />
<br />
Regards<br />
<br />
<script src="https://gist.github.com/4658702.js"> </script>
<br />
<code>
--<br />
= ^ . ^ =<br />
</code>
<br /><div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com0tag:blogger.com,1999:blog-6450097584789323100.post-62887928075227494942012-11-05T00:36:00.000-06:002012-11-05T00:44:17.727-06:00Apache httpd deflector shieldsToday I deceided to research which HTTP status codes are supported by the Apache httpd server, browsing around the source code repository [1] I found the http_protocol.c file which describes the implemented http status codes in the daemon.<br />
<br />
As part of my good practices I have developed an ErrorDocument template that I call "Deflector Shield" which returns a 302 status instead of 404, 403 or the awful 500. According to the official documentation [2], the directive goes as follows:<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">ErrorDocument <StatusCode> <Document></span><br />
Where<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><StatusCode></span> is one of the implemented in the source code [1]<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><Document></span> is an error message or the path to a resource (either local or remote)<br />
<br />
All this works for status codes other than 401 (Authorization Required) which require the message to be either the hardcoded or a custom string.<br />
<br />
The custom error document directives are here [3]
<br />
<script src="https://gist.github.com/4015668.js"> </script>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">[1] http://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x/modules/http/http_protocol.c</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">[2] http://httpd.apache.org/docs/2.2/mod/core.html#errordocument</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">[3] https://gist.github.com/4015668/</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">--</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> = ^ . ^ =</span><div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com0tag:blogger.com,1999:blog-6450097584789323100.post-32959389729013681772012-10-31T03:04:00.002-06:002012-11-05T00:42:33.401-06:00Zotero => bibtex with md5 identifiersI was just hesitated to see annoying useful BibTeX ids like: "???_tonejito_???" so I found this page [1] that shows how to mess with the Zotero Firefox plugin, and I came out with the idea of using the md5 of the title as identifier (for me that is better than the other id).<br />
<br />
The file in question was <FirefoxProfile>/zotero/translators/BibTeX.js the whole code is javascript so it's easy to modify and play with.<br />
<br />
Looking around the web I also found this github:gist [2] to calculate an md5 sum from a given string, I pasted all the code at the end of the file and used the md5_hex function as follows to replace the element key.<br />
<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">$ diff -u /tmp/BibTeX.js BibTeX.js </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">--- /tmp/BibTeX.js<span class="Apple-tab-span" style="white-space: pre;"> </span>2012-10-31 02:51:49.000000000 -0600</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">+++ BibTeX.js<span class="Apple-tab-span" style="white-space: pre;"> </span>2012-10-31 02:51:43.000000000 -0600</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">@@ -2083,7 +2083,8 @@</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <span class="Apple-tab-span" style="white-space: pre;"> </span>if(!type) type = "misc";</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <span class="Apple-tab-span" style="white-space: pre;"> </span>// create a unique citation key</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">-<span class="Apple-tab-span" style="white-space: pre;"> </span>var citekey = buildCiteKey(item, citekeys);</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">+<span class="Apple-tab-span" style="white-space: pre;"> </span>//var citekey = buildCiteKey(item, citekeys);</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">+<span class="Apple-tab-span" style="white-space: pre;"> </span>var citekey = hex_md5(buildCiteKey(item, citekeys));</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <span class="Apple-tab-span" style="white-space: pre;"> </span>// write citation key</span><br />
<br />
<br />
I'm currently using the Zotero plugin [3] and the zotero bibtex auto-exporter plugin [4], I tested this using the preferences pane for the autoexporter and run a manual test. After a couple of tries the results were like this:<br />
<br />
<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">@misc{20c7358045528f33804340fb6510b8b9,</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>title = {tonejito {(Andres} Hernandez) · {GitHub}},</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>url = {https://github.com/tonejito/},</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>urldate = {2012-10-31},</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>howpublished = {https://github.com/tonejito/},</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>file = {tonejito (Andres Hernandez) · GitHub:/Users/tonejito/Library/Application Support/Firefox/Profiles/profile.default/zotero/storage/AAAAAAAA/tonejito.html:text/html}</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">},</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">@misc{823e4a8551f18d37794d3115226700ba,</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>title = {Tonejito},</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>url = {http://tonejito.blogspot.com/},</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>urldate = {2012-10-31},</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>howpublished = {http://tonejito.blogspot.com/},</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>file = {Tonejito:/Users/tonejito/Library/Application Support/Firefox/Profiles/profile.default/zotero/storage/BBBBBBBB/tonejito.blogspot.com.html:text/html}</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">},</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">@misc{d83e6f346506b44510957a2fa00fff13,</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>title = {Andres Hernandez {(Tonejito)} on Twitter},</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>url = {https://twitter.com/tonejito},</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>urldate = {2012-10-31},</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>howpublished = {https://twitter.com/tonejito},</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>file = {Andres Hernandez (Tonejito) on Twitter:/Users/tonejito/Library/Application Support/Firefox/Profiles/profile.default/zotero/storage/CCCCCCCC/tonejito.html:text/html}</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">}</span><br />
<br />
<br />
<br />
So I can use any of this hashes in a LaTeX document like this and the bibliography entries will be sorted and referenced correctly.<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">\textbf{Twitter}</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">\cite{d83e6f346506b44510957a2fa00fff13}</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">\textbf{Blog}</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">\cite{823e4a8551f18d37794d3115226700ba}</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">\textbf{Github}</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">\cite{20c7358045528f33804340fb6510b8b9}</span><br />
<br />
<br />
<br />
Thanks LaTeX and BibTeX<br />
<br />
[1] http://www.curiousjason.com/zoterotobibtex.html<br />
[2] https://gist.github.com/951664<br />
[3] https://addons.mozilla.org/en-US/firefox/addon/zotero/<br />
[4] https://addons.mozilla.org/en-US/firefox/addon/zotero-bib-autoexport/<br />
<span style="font-family: Courier New, Courier, monospace;">--</span><br />
<span style="font-family: Courier New, Courier, monospace;"> = ^ . ^ =</span><div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com0tag:blogger.com,1999:blog-6450097584789323100.post-38005884986103435932012-07-26T15:08:00.000-05:002012-07-26T20:07:14.998-05:00Speeding up SSH logon<br />
A firewall blocks port 53 for my servers so ssh is trying to resolve my address every time I attempt log in.<br />
<br />
The timeout is frustrating, so I read the man page [1] and found this configuration directive<br />
<br />
<span style="font-family: Georgia, 'Times New Roman', serif;"> <b>UseDNS</b></span><span style="font-family: Georgia, 'Times New Roman', serif;"><i> Specifies whether sshd(8) should look up the remote host name and check that the resolved host name for the remote IP address maps back to the very same IP address. The default is ''yes''.</i></span><br />
<br />
I set it to 'no' and restarted the service and it worked like a charm :D<br />
<br />
Note:<br />
When working on OpenBSD, be sure to be logged in on the console by other method (like physical console access or serial) because restarting the ssh service on OpenBSD causes all remote sessions to be closed.<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">[1] http://linux.die.net/man/5/sshd_config</span><br />
<br />
--<br />
= ^ . ^ =<br /><div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com0tag:blogger.com,1999:blog-6450097584789323100.post-12041571510026741832012-07-25T13:15:00.002-05:002012-07-26T20:06:15.343-05:00Random Password Generator<br />
<span style="font-family: 'Courier New', Courier, monospace;">N := factor of 3</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">% N=9 ; (dd if=/dev/urandom bs=$N count=1 | uuencode -m - | sed -n '2p') 2>/dev/null</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">--</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> = ^ . ^ =</span><br /><div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.comtag:blogger.com,1999:blog-6450097584789323100.post-87715837831001804472012-06-29T18:13:00.000-05:002012-06-29T18:15:50.059-05:00% make FF<br />
<span style="font-family: 'Courier New', Courier, monospace;"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">% cat Makefile</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">FOLLOWERS?=</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">ME?=Tonejito</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">SIGNATURE?="= ^ . ^ ="</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">FF:</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if [ "${FOLLOWERS}" ] ; \</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>then \</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> for FOLLOWER in ${FOLLOWERS} ; \</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> do \</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> echo "FF @$$FOLLOWER" ; \</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> done ; \</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>else \</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> echo "FF @${ME}" ; \</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>fi ;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>echo ${SIGNATURE} ;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">--</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">% make -s</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">FF @Tonejito</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">= ^ . ^ =</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">% make -s FF FOLLOWERS="alpha beta gamma"</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">FF @alpha</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">FF @beta</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">FF @gamma</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">= ^ . ^ =</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">--</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">crontab -e</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"># m h dom mon dow command</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> 0 12 * * 5 make FF</span><br />
<div>
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span></div>
<br />
<span style="font-family: 'Courier New', Courier, monospace;">--</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>= ^ . ^ =</span><br />
<br /><div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com0tag:blogger.com,1999:blog-6450097584789323100.post-18815497780851337162012-06-19T11:41:00.000-05:002012-06-19T11:41:08.117-05:00Kill annoying processes that match a patternSo, there was a bunch of annoying processes named wit a pattern and I wanted to kill all of them<br />
<br />
Here is the script (I know this can be done in a much cleaner way in awk, but I like this way)<br />
<br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">#!/bin/sh</span><br />
<div>
<div>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">P="master(-worker)?"</span></div>
<div>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">PS=/bin/ps</span></div>
<div>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">SED=/bin/sed</span></div>
<div>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">KILL=/bin/kill</span></div>
<div>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">GREP=/bin/grep</span></div>
<div>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">CUT=/usr/bin/cut</span></div>
<div>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$KILL `$PS ax | $GREP -E $P | $GREP -v grep | $SED -e 's/^\ \+//g' | $CUT -d ' ' -f 1 | $GREP -E '^[[:digit:]]+'`</span></div>
</div>
<div>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">--</span></div>
<div>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> = ^ . ^ =</span></div><div class="blogger-post-footer">= ^ . ^ =</div>Tonejitohttp://www.blogger.com/profile/08464294924266825479noreply@blogger.com0