Skip to content

Instantly share code, notes, and snippets.

@r3bo0t
r3bo0t / git_basics
Created July 13, 2015 07:27
Simply Git
# Git?
* what is git?
* Git basics
# Git usages
* git commands
* git tools
# Git tools
* SublimeText [https://sublimegit.net/](link)
@r3bo0t
r3bo0t / pkall.sh
Last active August 29, 2015 14:12
Kill all shell process
#!/bin/bash -x
# Kill all the existing process with given name and for current user
user=whoami
for processid in `pgrep -U $user $1`; do
kill -9 $processid;
done
@r3bo0t
r3bo0t / shortener.py
Created August 16, 2013 06:13
Simplest code for url shortener application with Bottle
import gdshortener
from bottle import route, run, request
@route('/ping')
@route('/')
def index():
return '''
<form action="/url_shortener" method="post">
URL : <input name="url" type="text" />
<input value="Convert" type="submit" />
PROMPT='%{$fg_bold[green]%}%p %{$fg_bold[red]%}%% %{$reset_color%}'
local git_branch='$(git_prompt_status)%{$reset_color%}$(git_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
rvm_prompt='%{$fg[magenta]%}$(rvm-prompt r b g)%{$reset_color%}'
RPROMPT="%{$fg_bold[green]%}%c${rvm_prompt}|${git_branch}"
echo "Killing all instances found matching for "$1
ps aux | grep $1 | awk '{print $2; system("kill -9 "$2"");}'
alias g="git"
alias gp="git pull --rebase"
alias gps="git push"
alias gs="git status --short"
alias gst="git status"
alias gcm="git commit -m"
alias gca="git commit -am"
alias gco="git checkout"
alias glog="git --no-pager log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
alias m1="source ~/Sites/mongo-connect 1"
@r3bo0t
r3bo0t / mysql_s3_dumper.rb
Last active December 19, 2015 21:39
Customizing s3 database backup to keep only last 5 db entries
require 'mysql_s3_backup'
class MysqlS3Dumper
attr_accessor :config
class MysqlS3Backup::Backup
def full(name=make_new_name)
lock do
# When the full backup runs it delete any binary log files that might already exist
# in the bucket. Otherwise the restore will try to restore them even though they’re
# older than the full backup.
@r3bo0t
r3bo0t / prompt_krao_setup
Last active December 18, 2015 14:48
a minimalistic prezto prompt theme. Keep it in .zprezto/modules/prompt/functions
function prompt_krao_precmd {
vcs_info
}
function prompt_krao_setup {
autoload -Uz vcs_info
add-zsh-hook precmd prompt_krao_precmd
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' unstagedstr '!'
@r3bo0t
r3bo0t / get_rails_casts.rb
Created September 16, 2010 09:24
Crawler for downloading rails-cast videos
require 'rubygems'
require 'hpricot'
require 'open-uri'
class GetRailsCasts
def initialize
@host = "http://railscasts.com/episodes/"
end
def start
1.upto(231){ |eps|
@r3bo0t
r3bo0t / download_wiki.rb
Created September 16, 2010 09:18
Ruby crawler file for downloading externallinks for mediawiki for diff languages
require 'hpricot'
require 'open-uri'
require 'work_queue'
dir = Dir.new("path/to/your/dir")
class DownloadWiki
def initialize
@locales = collect_locales
@host = "http://download.wikimedia.org/"