Skip to content

Instantly share code, notes, and snippets.

View phcostabh's full-sized avatar
🧑‍💻
Coding

Philippe Santana Costa phcostabh

🧑‍💻
Coding
View GitHub Profile
" Base configuration {
set mouse=a " enable mouse
set mousehide " hide when characters are typed
set history=1000 " number of command lines to remember
set ttyfast " assume fast terminal connection
set viewoptions=folds,options,cursor,unix,slash " unix/windows compatibility
set encoding=utf-8 " set encoding for text
if exists('$TMUX')
set clipboard=
else
type fn func(string)
func compose(fns ...fn) fn {
return func(s string) string {
f := fns[0]
fs := fns[1:]
if len(fns) == 1 {
return f(s)
}
SELECT GROUP_CONCAT(CONCAT('KILL ',id,';') SEPARATOR ' ') 'command' FROM information_schema.processlist WHERE db = 'letras'
@phcostabh
phcostabh / gzip_to_zip.sh
Last active July 12, 2017 18:04
Convert gzipped files to zip using named pipes and parallelism (with xargs)
find *.gz | xargs -n 1 -P 4 -I{} bash -c 'f={}; mkfifo ${f%*.gz}; zip -9 -v -FI ${f%*.gz}.zip ${f%*.gz} & gunzip -cd $f > ${f%*.gz} && rm ${f%*.gz}'
const fs = require("fs");
fs.readFile("./manifest.json", (err, file) => {
const parsed = JSON.parse(file.toString());
const dependencies = parsed.dependencies;
Object.keys(dependencies).forEach(d => {
console.log("");
console.log("[[dependencies]]");
console.log(` name = "${d}"`);
const info = dependencies[d];
N=29; for f in *.mp4; do printf -v prefix_str '%02d' "$((N--))"; mv "$f" "$prefix_str-${f%-*.mp4}"; done
N=9; for f in $(find -type f -name '*.mp4' -exec stat --printf='%W %n\n' {} \; | sort -r | awk '{ print $2 }' | sed 's,\./,,'); do printf -v prefix_str '%02d' "$((N--))"; mv "$f" "$prefix_str-${f%-*.mp4}"; done
@phcostabh
phcostabh / gmtime.lua
Created February 1, 2016 17:51 — forked from ichramm/gmtime.lua
Lua function that returns the current time in UTC.
--[[!
-- @return The current time in UTC
--]]
function gmtime()
return os.time(os.date("!*t"));
end
#! /usr/bin/env sh
files=$(git diff --cached --name-only --diff-filter=ACM | grep ".js$")
if [ "$files" = "" ]; then
exit 0
fi
# Beautify Files
for file in $files; do js-beautify -r $file > /dev/null && git add $file; done
;;; Load color theme
(require-package 'ujelly-theme)
(load-theme 'ujelly t)
(require 'init-php-mode)
(require 'key-chord)
(key-chord-mode 1)
ps -p <pid> -o %cpu,%mem,cmd