Skip to content

Instantly share code, notes, and snippets.

docker rmi $(docker images | grep none | awk '{print $3}')
delimiter $$
CREATE FUNCTION `SPLIT_STR`(
x VARCHAR(255),
delim VARCHAR(12),
pos INT
) RETURNS varchar(255) CHARSET utf8 COLLATE utf8_unicode_ci
RETURN REPLACE(SUBSTRING(SUBSTRING_INDEX(x, delim, pos),
CHAR_LENGTH(SUBSTRING_INDEX(x, delim, pos -1)) + 1),
delim, '')
@pierophp
pierophp / reload_eth.sh
Created July 13, 2016 15:18
Restart Network
sudo rmmod r8169; sleep 1; sudo modprobe r8169;
@pierophp
pierophp / get_table_from_fullbackup.sh
Created July 5, 2016 19:08
Get Table From Full Backup
zcat my-full-backup.sql.gz | sed -n '/^-- Table structure for table `mytable`/,/^-- Table structure for table /p' > my-table.sql
sudo apt install texlive-extra-utils
pdfcrop --margins '5 10 5 20' input.pdf output.pdf
@pierophp
pierophp / restore_grub.sh
Created July 1, 2016 18:07
Restore Grub
sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update
sudo apt-get install -y boot-repair && boot-repair &
var separatePinyinInSyllables = function (pinyin) {
var vowels = 'aāáǎàeēéěèiīíǐìoōóǒòuūúǔù';
return pinyin
.replace(new RegExp('([' + vowels + '])([^' + vowels + 'nr\w\s])'), '$1 $2') // This line does most of the work
.replace(new RegExp('(\w)([csz]h)'), '$1 $2') // double-consonant initials
.replace(new RegExp('(n)([^' + vowels + 'vg\w\s])'), '$1 $2') // cleans up most n compounds
.replace(new RegExp('([' + vowels + 'v])([^' + vowels + '\w\s])([' + vowels + 'v])'), '$1 $2$3') // assumes correct Pinyin (i.e., no missing apostrophes)
.replace(new RegExp('([' + vowels + 'v])(n)(g)([' + vowels + 'v])'), '$1$2 $3$4') // assumes correct Pinyin, i.e. changan = chan + gan
ext install html-snippets
ext install html-css-class-completion
ext install debugger-for-chrome
ext install beautify
ext install bower
ext install Angular1
ext install JavaScriptSnippets
winpty docker exec -it CONTAINER_NAME bash
@pierophp
pierophp / swap_to_ram.sh
Created May 12, 2016 13:23
Mover a SWAP para RAM
sudo swapoff -a
sudo swapon -a