Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Shengjia Yan yanshengjia

🏠
Working from home
Block or report user

Report or block yanshengjia

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mw-ferretti
mw-ferretti / README.md
Last active Oct 13, 2019
Paypal button on markdown github
View README.md

Steps:

<!-- Sample of code generated --> 
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="RGQ8NSYPA59FL">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/pt_BR/i/scr/pixel.gif" width="1" height="1">
@sheharyarn
sheharyarn / mongo_backup.sh
Last active Oct 28, 2019
Mongodump Shell Script for Cronjob
View mongo_backup.sh
#!/bin/bash
MONGO_DATABASE="your_db_name"
APP_NAME="your_app_name"
MONGO_HOST="127.0.0.1"
MONGO_PORT="27017"
TIMESTAMP=`date +%F-%H%M`
MONGODUMP_PATH="/usr/bin/mongodump"
BACKUPS_DIR="/home/username/backups/$APP_NAME"
@fupslot
fupslot / gist:5015897
Created Feb 22, 2013
Javascript: Convert base64 to a Blob
View gist:5015897
function dataURItoBlob(dataURI, callback) {
// convert base64 to raw binary data held in a string
// doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this
var byteString = atob(dataURI.split(',')[1]);
// separate out the mime component
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]
// write the bytes of the string to an ArrayBuffer
var ab = new ArrayBuffer(byteString.length);
@jholster
jholster / gist:2290574
Created Apr 3, 2012
Tornado multiprocess example
View gist:2290574
import tornado.web
import tornado.httpserver
import tornado.ioloop
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Greetings from the instance %s!" % tornado.process.task_id())
app = tornado.web.Application([
(r"/", MainHandler),
@CristinaSolana
CristinaSolana / gist:1885435
Created Feb 22, 2012
Keeping a fork up to date
View gist:1885435

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@didip
didip / tornado_cookie_secret_generator.py
Created Feb 12, 2011
Generates secure cookie secret for Tornado Web Framework
View tornado_cookie_secret_generator.py
You can’t perform that action at this time.