Skip to content

Instantly share code, notes, and snippets.

View onionj's full-sized avatar
🧅
Onion!

Saman Nezafat onionj

🧅
Onion!
View GitHub Profile
@dmora
dmora / gist:03391e00a327396eca97
Created March 9, 2015 01:26
Upload local file with python to filepicker using their REST API
from poster.encode import multipart_encode
from poster.streaminghttp import register_openers
import urllib2
register_openers()
datagen, headers = multipart_encode({"fileUpload": open("filaname.jpg")})
request = urllib2.Request("https://www.filepicker.io/api/store/S3?key={yourKey}", \
datagen, headers)
response = urllib2.urlopen(request)
@ummahusla
ummahusla / git-overwrite-branch.sh
Last active May 20, 2024 16:27 — forked from brev/git-overwrite-branch.sh
Git overwrite branch with another branch
# overwrite master with contents of feature branch (feature > master)
git checkout feature # source name
git merge -s ours master # target name
git checkout master # target name
git merge feature # source name
@marcorichetta
marcorichetta / postgresql-manjaro.md
Last active July 24, 2024 20:22
Install PostgreSQL on Manjaro and set it up for Django
@maghorbani
maghorbani / coc.vim
Created March 31, 2021 14:50
coc vim configuration file -> ~/.config/nvim/plug-config/coc.vim
" Set internal encoding of vim, not needed on neovim, since coc.nvim using some
" unicode characters in the file autoload/float.vim
set encoding=utf-8
" TextEdit might fail if hidden is not set.
set hidden
" Some servers have issues with backup files, see #649.
set nobackup
set nowritebackup
func validateInitData(inputData, botToken string) (bool, error) {
initData, err := url.ParseQuery(inputData)
if err != nil {
logrus.WithError(err).Errorln("couldn't parse web app input data")
return false, err
}
dataCheckString := make([]string, 0, len(initData))
for k, v := range initData {
if k == "hash" {