Hacker News new | past | comments | ask | show | jobs | submit login

I use prefix qq for my commands because:

  1. It is easy to discover all customizations 
     via autocomplete
  2. It is not going to clash 
     with existing functionality

  # (Sort stuff by size, latest down, in a directory)
  alias qqsize="ls -lSrh"
  alias qqdate="ls -lrt"
  
  # First 100 of largest files/directories in a folder
  function qqlargest_files_100(){
    du -a ./ | sort -n -r | head -n 100
  }
  
  # Archivate item 
  qq-tar-gz-it () {
    tar -zcvf  $2 $1;
  }
  
  # Convert video to a gif
  function qq_convert_video_to_gif(){
    ffmpeg -i $1 $1.gif  
  }
  
  # Push to GitHub
  
  function togithub__master(){
      git add -A;
      git commit -m $1;
      git push github master;
  }
  
  # Symlink config file
  # 1. Move dotfile to a config directory.
  # 2. Strip the dot
  # 3. Symlink that file back to its place
  function qqsymlink_config_file(){
      directory_for_dot_file=$2
      name_of_dot_file=$1
      basename_of_dotfile=$(basename $name_of_dot_file)
      echo "Basename of dotfile: $basename_of_dotfile"
      dot_file_with_striped_dot=${basename_of_dotfile:1}
      new_file_path=$directory_for_dot_file/$dot_file_with_striped_dot
      echo "Moving $name_of_dot_file to $new_file_path";
      mv $name_of_dot_file $new_file_path;
      echo "Symlinking file $new_file_path to $name_of_dot_file ";
      ln -s $new_file_path  $name_of_dot_file;
  }
  
  # Enable touchpad
  function qq__touchpad_enable(){
      xinput set-prop $(xinput | grep Touch | grep -Po 'id=\K[0-9]+')  "Device Enabled" 1
  }
  
  # Set monitor highlighting 
  alias qq_set_higlighting_to_level_1_100="sudo xbacklight -set"
  
  # Display wifi SSID's
  alias qqwifi-spots="sudo iwlist scan | grep ESSID"
  
  # Add wifi network 
  function qqadd-wifi-network(){
      ## add-wifi-network just_wifi mypassword
      wpa_passphrase $1 $2 >> /etc/wpa_supplicant/wpa_supplicant.conf
  }
  
  # Various, misc
  
  # Mirror (webcam)
  alias mirror="vlc v4l2:///dev/video0"
  
  # Stopwatch/countdown
  function stopwatch(){
    date1=`date +%s`; 
     while true; do 
      echo -ne "$(date -u --date @$((`date +%s` - $date1)) +%H:%M:%S)\r"; 
      sleep 0.1
     done
  }
  
  function countdown(){
     date1=$((`date +%s` + $1)); 
     while [ "$date1" -ge `date +%s` ]; do 
       echo -ne "$(date -u --date @$(($date1 - `date +%s`)) +%H:%M:%S)\r";
       sleep 0.1
     done
  }
  
Some other stuff that I use daily and is too long to list here is:

  * an increment, deduplicating backup that takes
    around $0.52 per month on BackBlaze and on the 
    external hard drive via one command. 
    (Shameless plug: https://github.com/MichaelLeachim/borg_backblaze_backup)
  * Internet blocker.  (https://github.com/MichaelLeachim/internet_block)

Edit, formatting.



Cool, I like the qq-tar-gz-it, but I changed it to this:

function qq-tar-gz-it () { tar -zcvf ${1}.tar.gz $1; }

Saves a step.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: