This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
perl -0777 -pi -e 's/CRAZY/REGEXP/g' *FILES* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
module LogQuerySource | |
def debug(*args, &block) | |
return unless super | |
backtrace = Rails.backtrace_cleaner.clean caller | |
relevant_caller_line = backtrace.detect do |caller_line| | |
!caller_line.include?('/initializers/') | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
delay=$1 | |
resize=$2 | |
output=$3 | |
file_list=$4 | |
convert -delay $delay -resize $resize $file_list -loop 0 $output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Writeable | |
module Mixin | |
def self.included(base) | |
base.extend ClassMethods | |
end | |
module ClassMethods | |
def retrieve_connection | |
@pool ||= connection_handler.connection_pool_list.select do |p| | |
p.spec.config[:writeable] == true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class JoinFormatter | |
def initialize(separator = '', default = '') | |
@default = default | |
end | |
def format(elements) | |
res_string = elements.join '' | |
return @default if res_string == '' | |
res_string | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Animal | |
constructor: (@name) -> | |
@kind = 'animal' | |
say_hello: -> | |
alert "Hello human! I'm #{@kind} named #{@name}" | |
alterVoice: (voice) -> | |
@voice = voice | |
class Dog extends Animal | |
constructor: (@name) -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#create dump: | |
pg_dump -h <HOSTNAME> -U <USERNAME> -b -Fc <DBNAME> | bzip2 -c > <WHERE_TO_DUMP>.bz2 | |
#restore dump: | |
bzip2 -d -c <FILE> | pg_restore -h <HOSTNAME> -U <USERNAME> -d <DBNAME> -Fc -O -c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fish-shell | |
for branch in (git branch --merged master | grep -v "^\ *master") | |
git push origin :(echo $branch | sed 's/\ *//') | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
----- Esc ----- | |
Quick change directory: Esc + c | |
Quick change directory history: Esc + c and then Esc + h | |
Quick change directory previous entry: Esc + c and then Esc + p | |
Command line history: Esc + h | |
Command line previous command: Esc + p | |
View change: Esc + t (each time you do this shortcut a new directory view will appear) | |
Print current working directory in command line: Esc + a | |
Switch between background command line and MC: Ctrl + o | |
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name |