UrFix's Blog

A geek without a cause

  • Hide your files really good in Linux

    by

    Hide your files really good in Linux

    I have tons of confidential files on my Hard drive and I share my computer with a few people. So how do I keep my files private? tar, Gzip GPG and XZ that’s how I hide them!

    $ tar -c dir/ | gzip | gpg -c | xz -9 |dd of=dir.tar.gz.gpg.xz

    this command creates a tar file from dir folder and pipes it to gzip for compression then piped to gpg for encryption then piped again to xz for additional compression and outputted as dir.tar.gz.gpg.xz

    extract and decrypt your file with

    $ xz -d dir.tar.gz.gpg.xz && gpg -d dir.tar.gz.gpg | tar xfz –

    You can substitute gpg for mcrypt

    $ tar -c dir/ | xz -9 |mcrypt -a arcfour –mode stream -F |dd of=dir.tar.xz.nc

    Similar to before this command creates a *tar* file of the dir folder, compresses it with xz, but encrypts it with mcrypt arcfour algorithm

    extract with

    $ mcrypt -d dir.tar.xz.nc && xz -d dir.tar.xz && tar xf dir.tar

    Just remember a few things. One make sure you use a strong enough key so its harder to crack. Two if some one hijacks your computer they can read what’s in the RAM, and three I ca not stress the importance of having a complex secret key. Nothing less that 18 characters and use lowercase and uppercase mix in numbers and symbols such as @,#,^,%, and *.
    Another thing I do is I chmod my files with 600 so users have no kind of permission over the file.
    Keep your data safe.

  • Transferring YouTube videos “or anything else” to your LG Phone

    by

    I have an old LG Envy2 phone with Verizon. I’ve tried upgrading the phone, but since I now live in Puerto Rico it’s no longer an option. I would be forced to switch my service over to Claro, an upcoming phone company that purchased Verizon’s contracts here in Puerto Rico. And to be honest I don’t want to lose my phone number. I’ve had the same number for some 13 years and I’m not about to give it up now. So I’m stuck with this ancient mobile phone and no VCAST coverage, so I can’t even  use the Verizon’s network to download cool videos to my phone. But it’s okay I have found a cool and easy way to transfer videos to my phone.

    This is my technique, I use Mozilla Firefox along with VideoHelper to download. I also have a 2gb micro sd chip in the phone.

    Fire up your terminal

    $ ffmpeg -i input.flv -vcodec mpeg4 -ar 44100 -b 270k -s 320×240 output.mp4

     

    “-vcodec forces video codec -ar sets the audio sampling frequency while -b sets the video’s bitrate  and -s sets the frame size”

     

    replace input.flv with the  location and file name of the video you just downloaded.

    the command will produce output.mp4 just go ahead and copy that file over to the phone’s chip through either a USB cable or directly on to the chip using what ever tool or method you may posses.

    a similar technique can be used to copy decrypted DVDs over to your phone.

    Mount the DVD rom

    I like to use VLC to find which are the VOB files I need to rip. Just open the VOB file from the VIDEO_TS folder with vlc and figure out which files you want to copy to your phone

    then use FFmpeg to rip the files

    $ ffmpeg -i VTS_01_1.VOB -qscale 20 -intra -ac 2 -vcodec mpeg4 -ar 44100 -b 270 -s 320×240 VTS_01_1.mp4

    do that for each VOB and copy them over.

     

    To have a constant quality (but a variable bitrate), use the option

    ‘-qscale n’ when ‘n’ is between 1 (excellent quality) and 31 (worst quality)

    ffmpeg -i VTS_01_1.VOB -qscale 20 -intra -ac 2 -vcodec mpeg4 -ar 44100 -b 270 -s 320×240 VTS_01_1.mp4

     

    Now you can watch your favorite movies or funny YouTube videos any where you can take your phone.

  • The Simpsons Couch Gag Goes ASCII

    by

    Sunday March 27 The creators of The Simpsons created an awesome ASCII couch gag. The couch gag begins with the family jumping on the couch as usual. Then Bart removes the letters F A T S and O from Homer’s knees and places them on Homer’s belly. Homer looks down at his stomach,  discontented, and  text bubble with the  words “D’ OH!” appear

     

  • 9 Really Useful Tricks With pv- Pipe Viewer

    by

    pv allows a user to see the progress of data through a pipeline, by giving information such as time elapsed, percentage completed (with progress bar), current throughput rate, total data transferred, and ETA.

    Here’s a nice list of cool ways you can use pv

    1) Simulate typing

    echo "You can simulate on-screen typing just like in the movies" | pv -qL 10

    This will output the characters at 10 per second.

    2) Monitor progress of a command

    pv access.log | gzip > access.log.gz
    

    Pipe viewer is a terminal-based tool for monitoring the progress of data through a pipeline. It can be inserted into any normal pipeline between two processes to give a visual indication of how quickly data is passing through, how long it has taken, how near to completion it is, and an estimate of how long it will be until completion.

    3) live ssh network throughput test

    yes | pv | ssh $host "cat > /dev/null"
    

    connects to host via ssh and displays the live transfer speed, directing all transferred data to /dev/null

    4) copy working directory and compress it on-the-fly while showing progress

    tar -cf - . | pv -s $(du -sb . | awk '{print $1}') | gzip > out.tgz

    What happens here is we tell tar to create “-c” an archive of all files in current dir “.” (recursively) and output the data to stdout “-f -“. Next we specify the size “-s” to pv of all files in current dir. The “du -sb . | awk ?{print $1}?” returns number of bytes in current dir, and it gets fed as “-s” parameter to pv. Next we gzip the whole content and output the result to out.tgz file. This way “pv” knows how much data is still left to be processed and shows us that it will take yet another 4 mins 49 secs to finish.

    5) Copy a file using pv and watch its progress

    pv sourcefile > destfile

    pv allows a user to see the progress of data through a pipeline, by giving information such as time elapsed, percentage completed (with progress bar), current throughput rate, total data transferred, and ETA. (man pv)

    6) Another live ssh network throughput test

    pv /dev/zero|ssh $host 'cat > /dev/null'

    connects to host via ssh and displays the live transfer speed, directing all transferred data to /dev/null

    7) dd with progress bar and statistics

    sudo dd if=/dev/sdc bs=4096 | pv -s 2G | sudo dd bs=4096 of=~/USB_BLACK_BACKUP.IMG

    This command utilizes ‘pv’ to show dd’s progress.

    Notes on use with dd:

    — dd block size (bs=…) is a widely debated command-line switch and should usually be between 1024 and 4096. You won’t see much performance improvements beyond 4096, but regardless of the block size, dd will transfer every bit of data.

    — pv’s switch, ‘-s’ should be as close to the size of the data source as possible.

    — dd’s out file, ‘of=…’ can be anything as the data within that file are the same regardless of the filename / extension.

    8) [re]verify a disc with very friendly output

    dd if=/dev/cdrom | pv -s 700m | md5sum | tee test.md5

    [re]verify those burned CD’s early and often – better safe than sorry –

    at a bare minimum you need the good old `dd` and `md5sum` commands,

    but why not throw in a super “user-friendly” progress gauge with the `pv` command –

    adjust the “-s” “size” argument to your needs – 700 MB in this case,

    and capture that checksum in a “test.md5” file with `tee` – just in-case for near-future reference.

    *uber-bonus* ability – positively identify those unlabeled mystery discs –

    for extra credit, what disc was used for this sample output?

    9) time how fast the computer reads from /dev/zero

    pv /dev/zero > /dev/null

    my stats 217GB 0:00:38 [4,36GB/s]

Chat

Hi 👋, how can we help?