tag:blogger.com,1999:blog-3223067306933439872024-02-20T01:13:48.303-08:00random thoughtsmliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.comBlogger35125tag:blogger.com,1999:blog-322306730693343987.post-53710064252224377112023-11-02T00:50:00.005-07:002023-11-02T00:50:32.548-07:00Converting MBR to GPT<p>Recently I purchased a new MB for my garage PC - Asrock N100DC-ITX. Trying to move my existing HDDs onto this new MB, I discovered I'm not able to boot from the MBR HD, like on my previous machine. There was no way to enable this on BIOS/UEFI so I decided to move to GPT. Here are some useful links:</p><ul style="text-align: left;"><li><a href="https://serverfault.com/questions/963178/how-do-i-convert-my-linux-disk-from-mbr-to-gpt-with-uefi">https://serverfault.com/questions/963178/how-do-i-convert-my-linux-disk-from-mbr-to-gpt-with-uefi</a></li><li><a href="https://superuser.com/questions/590525/install-deb-packages-into-mounted-fs">https://superuser.com/questions/590525/install-deb-packages-into-mounted-fs</a></li><li><a href="https://unix.stackexchange.com/questions/395183/chroot-failed-to-run-command-bin-bash-permission-denied">https://unix.stackexchange.com/questions/395183/chroot-failed-to-run-command-bin-bash-permission-denied</a></li><li><a href="https://unix.stackexchange.com/questions/174021/chroot-permission-denied-but-im-root">https://unix.stackexchange.com/questions/174021/chroot-permission-denied-but-im-root</a></li><li><a href="https://unix.stackexchange.com/questions/405472/cannot-find-efi-directory-issue-with-grub-install">https://unix.stackexchange.com/questions/405472/cannot-find-efi-directory-issue-with-grub-install</a><br /></li></ul>mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-22990070991365020202023-04-14T02:35:00.001-07:002023-04-14T02:35:18.407-07:00How to test microphone with pulseaudio<p><br /><br />How to test that your microphone is working, using pulseaudio:</p><p><span style="font-family: courier;">pactl load-module module-loopback latency_msec=1</span></p><p>To disable it again:</p><p><span style="font-family: courier;">pactl unload-module module-loopback <br /></span><br />Thanks to: <a href="https://askubuntu.com/a/262297">https://askubuntu.com/a/262297</a><br /></p>mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-13068861325243500772023-04-04T02:12:00.002-07:002023-04-04T05:05:46.077-07:00Set file modification time based on file name (or EXIF data)<p>This snippet works for the Iphone image/movie files in format: <span style="font-family: courier;">YY-MM-DD HH24-MI-SS NNNN.ext</span></p><p><br /></p><div style="text-align: left;"><span style="font-family: courier;">for f in *mov; do</span></div><div style="text-align: left;"><span style="font-family: courier;"> echo $f</span></div><div style="text-align: left;"><span style="font-family: courier;"> touch "$f" -t "20${f:0:2}${f:3:2}${f:6:2}${f:9:2}${f:12:2}.${f:15:2}"</span></div><div style="text-align: left;"><span style="font-family: courier;">done</span></div><p><br /></p><p>Then, to overwrite with EXIF information from JPEG files:</p><p><span style="font-family: courier;">exiv2 -T rename *.jpg</span></p><p><br /></p><p>Useful snippet for some of the Iphone files/movies on my disk:</p><div style="text-align: left;"><span style="font-family: courier;">find . -type f -name \*720p.mov | while read LINE; do</span></div><div style="text-align: left;"><span style="font-family: courier;"> f=$(basename "$LINE")</span></div><div style="text-align: left;"><span style="font-family: courier;"> echo "$LINE"</span></div><div style="text-align: left;"><span style="font-family: courier;"> touch "$LINE" -t "20${f:0:2}${f:3:2}${f:6:2}${f:9:2}${f:12:2}.${f:15:2}"</span></div><div style="text-align: left;"><span style="font-family: courier;">done</span><br /></div>mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-5405613943573247652023-04-04T02:02:00.000-07:002023-04-04T02:02:40.069-07:00Delete broken symlinks<p>Identify broken symbolic links:</p><p><span style="font-family: courier;">find . -xtype l</span></p><p>To delete as well:</p><p><span style="font-family: courier;">find . -xtype l -delete</span></p><p><br /></p>mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-7128789488054045432023-04-04T01:41:00.002-07:002023-07-11T07:29:31.577-07:00Remove duplicate files<p>Use rdfind tool from Debian repo.<br /></p><p>To find duplicate files in directories <b>dir1</b> (and <b>dir2</b>) with <b>results.txt</b> output file produced:</p><span style="font-family: courier;">rdfind dir1 [dir2]</span><p><br />To test:</p><p><span style="font-family: courier;">rdfind -n true -deleteduplicates true dir1 dir2</span></p><p>To delete duplicates:</p><p><span style="font-family: courier;">rdfind -deleteduplicates true dir1 dir2</span></p><p><br /></p>mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-39718679627877650772016-10-04T05:31:00.001-07:002016-10-04T05:31:41.877-07:00Eaton 3S disconnect problemRecently I bought Eaton 3S UPS for my home server. I bought this model because it's supposed to have good Linux support and the size is quite small.<br />
<br />
All works fine but after a few days I keep getting disconnects and machine load increases to about 2.0. The messages in syslog are:<br />
<br />
<code>
Oct 4 06:54:13 atom2 upsmon[1785]: Poll UPS [eaton3s@localhost] failed - Data stale<br />
Oct 4 06:54:16 atom2 kernel: [934148.871714] usb 1-5.2: device descriptor read/64, error -110<br />
Oct 4 06:54:16 atom2 kernel: [934149.047613] usb 1-5.2: new low-speed USB device number 5 using xhci_hcd<br />
Oct 4 06:54:18 atom2 upsmon[1785]: Poll UPS [eaton3s@localhost] failed - Data stale</code><br />
<code><br />
</code>
What I need to do now is not only restart <b>nut</b> but also unload the <b>xhci_hcd</b> module:
<code> </code><br />
<br />
<code>/etc/init.d/nut-client stop<br />
/etc/init.d/nut-server stop<br />
</code><br />
Check and kill all remaining processes:<br />
<br />
<code>ps -ef|grep -i -e usb -e hid -e ups -e eaton -e nut<br />
</code><br />
Unload module:<br />
<br />
<code>modprobe -r xhci_hcd
</code>
Load module:<br />
<code>
modprobe xhci_hcd</code><br />
<br />
Start <b>nut</b>:<br />
<br />
<code>/etc/init.d/nut-server start<br />
/etc/init.d/nut-client start<br />
</code>
mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-36962763959891684092013-04-11T07:03:00.000-07:002013-04-11T07:03:41.505-07:00Lenovo USB Ethernet adapter and DebianI bought Lenovo USB Ethernet adapter for my home PC that I set up as a router. The problem is Debian stable does not contain driver for this device (USB ID 17ef:7203), I needed to compile my own.<br />
I found some help on the following pages:<br />
<a href="https://github.com/torvalds/linux/blob/66dc81ecd71332783c92fb170950d5ddb43da461/drivers/net/usb/asix_devices.c">Linux asix_devices.c</a><br/>
<a href="http://chentiangemalc.wordpress.com/2012/10/22/case-of-the-broken-linux-driver-lenovo-usb-2-0-ethernet-10100-dongle/">Case of the Broken Linux Driver (Lenovo USB 2.0 Ethernet 10/100 dongle)</a><br/>
I needed to change &ax88772b_info in the code snippet.mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com1tag:blogger.com,1999:blog-322306730693343987.post-14124738762369680262013-04-11T06:56:00.002-07:002013-04-11T06:56:52.610-07:00Static IPs and DHCPCollection of links, that helped me set up static IPs for certain devices in my home network.<br />
<a href="http://rhodesmill.org/brandon/2008/tomato-reverse-dns/">Name your home machines using Tomato</a><br/>
<a href="http://johnbokma.com/mexit/2008/09/03/dhcp-static-ip-dnsmasq.html">DHCP static IP addresses with dnsmasq</a><br />
<a href="http://www.cyberciti.biz/faq/dhclient-etcresolvconf-hooks/">How To: Make Sure /etc/resolv.conf Never Get Updated By DHCP Client</a><br />
<br />mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-10676936716380294412012-11-29T02:55:00.001-08:002012-11-29T02:55:15.603-08:00Munin and Dreambox DM500HDI bought DM500HD a few months ago. Since it's always on, I intended to install <a href="http://munin-monitoring.org/">munin</a> monitoring on it. The problem is it does not have Perl bundled.<br />
First I wanted to install Perl (I even tried to install mipsel packages from Debian and it kind of worked), but then I found <a href="https://sourceforge.net/projects/muninlite/">muninlite</a> which perfectly fit my need.<br />
I developed 2 new plugins to monitor its temperature and fan speed.mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-62506374718297105732012-07-01T16:03:00.002-07:002012-07-01T16:18:40.062-07:00Upgrade to 12.04I just upgraded my htpc to Ubuntu 12.04. The upgrade was done via ssh, no problems at all.<br />
The problem is xbmc, as usual after an upgrade. My custom keys mapping I described <a href="http://mliptak.blogspot.sk/2010/03/keys-mapping.html">here</a> stopped working. And the auto-hibernate stopped working as well. Currently investigating.<br />
<br />
EDIT: suspend fixed <a href="http://wiki.xbmc.org/index.php?title=HOW-TO:Suspend_and_wake_in_Ubuntu">following instructions here</a><br />
keys fixed using <a href="http://ubuntuforums.org/showthread.php?p=11590929#post11590929">instructions here</a>mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-86969345691626609732012-06-06T02:58:00.001-07:002012-06-06T02:58:02.885-07:00History in sqlplusUse rlwrap sqlplus.
Credit goes to <a href="https://blogs.oracle.com/middleware/entry/getting_history_from_sqlplus_using">this blog post</a>.mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-74651091675891613092011-10-25T23:43:00.000-07:002011-10-25T23:43:38.355-07:00ID3 v2.4 tagsIt all started when I found out my xmms2 did not read ID3 tags of some of my files properly. I use kid3 to create and modify the ID3 tags of my music collection and it was reading them all OK, so I started investigating.
The first clue was <a href="http://sourceforge.net/tracker/?func=detail&atid=104193&aid=3395550&group_id=4193">this bug in id3v2</a> which did not read the ID3 tags as well, so I recompiled the latest sources but still no cigar. I learned id3v2 is using id3lib to parse tags and I found <a href="http://sourceforge.net/tracker/?func=detail&aid=1500788&group_id=979&atid=100979">this bug</a>. So I changed the <code>ID3V2_LATEST = ID3V2_3_0</code> to <code>ID3V2_LATEST = ID3V2_4_0</code> and it all started working. The question is why is this not enabled by default.mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-66416187484615890232011-09-29T16:07:00.000-07:002011-09-29T16:09:25.174-07:00Moving a GPG Key (Privately)<a href="http://montemazuma.wordpress.com/2010/03/01/moving-a-gpg-key-privately/">How to move your public and private GPG keys from one machine to another.</a>mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-86094164590622314492011-08-01T23:08:00.000-07:002011-08-01T23:08:08.689-07:00Machine Cycle: SSH and DBUS Sessions<a href="http://machine-cycle.blogspot.com/2010/12/ssh-and-dbus-sessions.html">Machine Cycle: SSH and DBUS Sessions</a>mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-4768285219441765722011-08-01T22:55:00.000-07:002011-08-01T23:00:29.564-07:00Get rid of w00tw00tEver since I installed Apache on my server, I noticed annoying <a href="http://www.google.com/search?q=w00tw00t">w00tw00t</a> requests in the access log. At first I created fail2ban rule to block the IPs that originated the requests, but of course this is quite useless, since the requests come from different IPs and only repeat from the same IP after a few days.<br />So I found out the best solution to be <a href="http://spamcleaner.org/en/misc/w00tw00t.html">blocking it at iptables level</a>.mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-65972555229088784512011-07-28T02:46:00.000-07:002011-12-14T01:28:39.163-08:00Munin/rrdtool spike removalOccasionally I see spikes on my network card charts. I found <a href="http://munin-monitoring.org/wiki/SpikeRemoval">this article</a> which says how to remove them and basically it shows how to convert the rrd file to xml and vice versa, so it's worth remembering.<br />
<pre>cd /var/lib/munin/HOSTNAME</pre>
<pre># To export rrd file to xml, use
rrdtool dump file.rrd > file.rrd.xml
# Move the rrd file to backup
mv file.rrd file.rrd.bak
# To convert from xml to rrd, use:
rrdtool restore -r file.rrd.xml file.rrd
# In case running under different user (e.g. root), don't forget to change back the ownership of rrd files:
chown munin:munin file.rrd
# To regenerate graphs, run as munin:
/usr/share/munin/munin-graph --nolazy --host $HOSTNAME --force</pre>mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-83633519902453487392011-07-01T06:04:00.000-07:002011-07-01T06:14:20.071-07:00mycal2remI was using <a href="http://wiki.43folders.com/index.php/ICal2Rem">ical2rem.pl</a> to pull data off my Google calendar and display it in wyrd, which I'm using on my laptop. After a while I found a few shortcomings:<br />- the parsing of the .ics file from Google took about 25 seconds (on my Intel CoreII Duo T7100) during which the CPU was fully utilized<br />- the script does not use the features of remind format, e.g. the repeating events are created as multiple entries in the remind file<br /><br />The mycal2rem.pl is far from full implementation of the .ics format (RFC 5545), but currently it parses all events from my calendar just fine.<br /><br />The script can be found at <a href="https://github.com/mehturt/mycal2rem">github</a>.mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-26872385261634462192011-06-20T09:32:00.000-07:002011-06-20T09:45:38.197-07:00fail2banI am quite happy user of denyhosts for my server.<br />However, I started to look for a solution that is able to block access to other services as well. And I discovered fail2ban.<br />I am using it to block access to my ssh server and also my apache server, because there is a few queries for the phpmyadmin etc.<br />There were a few issues with stock fail2ban, namely <a href="http://askubuntu.com/questions/27601/what-are-fail2bans-log-iptables-returned-nnn-entries-fail2ban-is-failing-to">What are fail2ban's log iptables “returned NNN” entries? (Fail2ban is failing to ban)</a> and <a href="http://oschgan.com/drupal/index.php?q=node/52">fail2ban startup iptables error</a>.<br />Another problem is that the banned IPs are lost on fail2ban restart. I managed to fix that somehow bu exporting the list of banned IPs on service stop and importing it back again on service start. I even posted the way to export banned IPs to <a href="http://www.fail2ban.org/wiki/index.php/Fail2ban:Community_Portal#Question_about_persistent_IP_address_bans_over_restart">the wiki</a><br /><pre><br />#!/bin/sh<br />jails=$(fail2ban-client status | grep Jail\ list: | sed 's/.*Jail list:\t\+//;s/,//g')<br />for jail in ${jails}; do<br /> for ip in $(fail2ban-client status ${jail}|grep IP\ list|sed 's/.*IP list:\t//'); do<br /> echo "fail2ban-client set ${jail} banip ${ip}"<br /> done<br />done<br /></pre><br />So far it works fine for me.mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-5172870113720508892011-05-10T14:06:00.000-07:002011-05-10T14:13:21.005-07:00Converting AVCHD Videos (part 2)Recently I tried to use <a href="http://mliptak.blogspot.com/2010/09/converting-avchd-videos.html">ffmpeg to convert AVCHD to mp4</a>. However I experienced sound issues and I discovered the default audio bitrate was used (64k). I needed to enhance the command to:<br /><blockquote>ffmpeg -i $1 -sameq -ab 192000 -f mp4 $1.mp4</blockquote><br />This is on Ubuntu 11.04 x86_64.mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-75045149849754338712011-03-08T01:29:00.000-08:002011-03-08T01:30:54.014-08:00How to un-break graphical Java apps under RatpoisonFinally, <a href="http://www.loper-os.org/?p=163">the ultimate solution</a>.<br />Thanks!mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-57758537121551306442011-02-15T15:43:00.000-08:002011-02-15T15:48:23.250-08:00DropboxI wanted to start using my Ubuntu One on my Debian server. Instead I tried out <a href="http://dropbox.com">Dropbox</a>. The installation is straightforward, I followed <a href="http://wiki.dropbox.com/TipsAndTricks/TextBasedLinuxInstall">this guide</a>. I needed to update the <a href="http://wiki.dropbox.com/TipsAndTricks/TextBasedLinuxInstall/UbuntuStartup">init.d</a> script a little (I even updated the wiki @ Dropbox site).<br />I plan to use my account to store backups of my SVN repository, it's very small at the moment so the free 2GB quota should be enough for me. I will create a script that will compress, encrypt and store the SVN repo to Dropbox.mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-82098865767429782732011-02-06T13:26:00.000-08:002011-02-06T13:29:08.311-08:00Update to SqueezeJust updated to <a href="http://www.debian.org/News/2011/20110205a">Squeeze</a>. No issues so far, only <a href="http://packages.debian.org/stable/munin">munin</a> got relocated from /var/cache/munin/www to /var/www/munin .mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-65033642795214519522011-01-25T14:05:00.000-08:002011-01-25T14:07:36.723-08:00chmod recursion -- files only<a href="http://www.linuxquestions.org/questions/aix-43/chmod-recursion-files-only-208798/">chmod recursion -- files only</a><br />A great thread! Learned something new today again.mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-67750746561101437682011-01-19T14:33:00.000-08:002011-01-19T14:35:35.960-08:00SFTP on Ubuntu/DebianI reused this article again, so it's worth bookmarking.<br /><a href="http://blog.markvdb.be/2009/01/sftp-on-ubuntu-and-debian-in-9-easy.html">SFTP on Ubuntu and Debian in 9 easy steps</a>mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0tag:blogger.com,1999:blog-322306730693343987.post-62433269292786502022011-01-11T14:29:00.001-08:002011-01-11T14:30:55.238-08:00BuzzGoogle saved my ass once again..<br /><a href="http://www.youtube.com/watch?v=6JVqj7TIi-k">http://www.youtube.com/watch?v=6JVqj7TIi-k</a>mliptakhttp://www.blogger.com/profile/08437775299403493848noreply@blogger.com0