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
#Assuming module foo with method bar: | |
import foo | |
methodToCall = getattr(foo, 'bar') | |
result = methodToCall() | |
#As far as that goes, lines 2 and 3 can be compressed to: | |
result = getattr(foo, 'bar')() | |
#https://stackoverflow.com/questions/3061/calling-a-function-of-a-module-from-a-string-with-the-functions-name-in-python |
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
import tgl | |
import os | |
# This is a python script that run with tg and notify when get new message | |
# Using terminal-notifier https://github.com/julienXX/terminal-notifier | |
# The notifier function | |
def notify(title, subtitle, message): | |
t = '-title "%s"' % title | |
s = '-subtitle "%s"' % subtitle |
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
deb http://debian.xtdv.net/debian/ wheezy main contrib non-free |
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
# need to setup dns of your domain first | |
# cert will be stored in /etc/letencrypt | |
# renew command without --force-renew will not get new certificate if old certificate has long live til expired | |
./letsencrypt-auto certonly --webroot -w /usr/share/nginx/www -d domain.com --email [email protected] --agree-tos |
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
openssl req -newkey rsa:2048 -sha256 -nodes -keyout khapota.key -x509 -days 365 -out khapota.pem -subj "/C=US/ST=New York/L=Brooklyn/O=Example Brooklyn Company/CN=khapota.info" |
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
import requests | |
files = {"upload_file": open('path/to/file.txt', 'rb')} | |
data = {"content": "test upload"} | |
requests.post(url, files=files, data=data) |
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
function updatePrice($itemId, $price, $title) { | |
$header = array('Host' => 'eu1.linnworks.net', | |
'Connection' => 'keep-alive', | |
'Accept' => 'application/json, text/javascript, */*; q=0.01', | |
'Origin' => 'https://www.linnworks.net', | |
'User-Agent' => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36', | |
'Content-Type' => 'application/x-www-form-urlencoded; charset=UTF-8', | |
'Referer' => 'https://www.linnworks.net/', | |
'Authorization' => '6f004779-0784-45bd-86b5-7bec6bc475', | |
'Accept-Encoding' => 'gzip, deflate'); |
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
source ~/.zplug/init.zsh | |
## Prezto | |
zplug "modules/directory", from:prezto | |
zplug "modules/environment", from:prezto | |
zplug "modules/history", from:prezto | |
zplug "modules/completion", from:prezto | |
zplug "modules/spectrum", from:prezto | |
zplug "modules/git", from:prezto | |
zplug "modules/utility", from:prezto |
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 | |
git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it | |
~/.bash_it/install.sh |
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
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') | |
" let Vundle manage Vundle, required |