This file contains hidden or 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
import time | |
def timed(func): | |
def function_timer(*args, **kwargs): | |
start = time.time() | |
result = func(*args, **kwargs) | |
end = time.time() | |
runtime = (end - start)*1000 | |
message = f"Function [{func.__name__}] executed in {runtime} ms" |
This file contains hidden or 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 | |
################################################################################ | |
## Similar to run: ps aux | grep "RegExp" ## | |
## Script that receives a list o keywords and search then in "ps axw" command ## | |
## and returns ps's header and processes that where found with keywords. ## | |
## Accepts grep options, like '-c' to count number of matched processes. ## | |
################################################################################ | |
if [ "$#" -eq 0 ]; then |
This file contains hidden or 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
--[[ | |
usage: | |
local form = multipart:new() | |
-- set any opts | |
form:parse() | |
-- form.fields | |
]] | |
local ngx = require("ngx") | |
local upload = require("resty.upload") |
This file contains hidden or 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/sh | |
mkdir -p ~/.vim/syntax/ | |
cd ~/.vim/syntax/ | |
wget http://www.vim.org/scripts/download_script.php?src_id=19394 | |
mv download_script.php\?src_id\=19394 nginx.vim | |
cat > ~/.vim/filetype.vim <<EOF | |
au BufRead,BufNewFile /etc/nginx/*,/usr/local/nginx/conf/* if &ft == '' | setfiletype nginx | endif | |
EOF |
This file contains hidden or 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 | |
# starman - this script starts and stops the starman daemon | |
# | |
# chkconfig: - 85 15 | |
# description: Starman | |
# processname: starman | |
# pidfile : /var/run/starman.pid | |
# www file: /var/www/myapp |
This file contains hidden or 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
#!/usr/bin/env python | |
""" | |
Ever had a mysqldump of utf8 data stored in latin1 tables, dumped in utf8 and | |
munged with windows cp1252? | |
If so this is your friend. Just pipe it through this little baby and spare | |
yourself hours of unicode hell- it'll take your dirt and spit out clean utf8. | |
You can also import it and use it in your python code. |