Skip to content

Instantly share code, notes, and snippets.

@lyoe
lyoe / Pull-and-Sync-Data-Between-Google-Doc-Spreadsheet-and-MySQL.gs
Created December 28, 2018 06:00
You can pull data from MySQL database to Google doc spreadsheet auto with just click of a button or scheduled time. This is great use for retrieving data in spreadsheet format.
// MySQL to Google Spreadsheet By Pradeep Bheron
// Support and contact at pradeepbheron.com
function myMySQLFetchData() {
var conn = Jdbc.getConnection('jdbc:mysql://127.0.0.1:3306/employee_db', 'username', 'pass'); // Change it as per your database credentials
var stmt = conn.createStatement();
var start = new Date(); // Get script starting time

Keybase proof

I hereby claim:

  • I am makeitjoe on github.
  • I am makeitjoe (https://keybase.io/makeitjoe) on keybase.
  • I have a public key ASCVMdLww8H_1eEK3Ay9iq8uDMDt3YL1zdQFRS7TgZnJNAo

To claim this, I am signing this object:

@lyoe
lyoe / PDF_MERGE.md
Created June 23, 2016 06:51
A quick way to to merge PDFs into one using

NOTE: GhostScript must be intalled

Mac Install instructions

brew install gs

Then run ghostscript listing all files to merge.

@lyoe
lyoe / youtube-dl.script
Created June 3, 2016 13:48
Alfred Example for youtube-dl.
on alfred_script(q)
tell application "iTerm"
activate
try
select first window
on error
create window with default profile
select first window
end try
@lyoe
lyoe / gist:4386094
Created December 27, 2012 06:59
tornado autoreload
from apps import app
from tornado import autoreload
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
if __name__ == '__main__':
http_server = HTTPServer(WSGIContainer(app))
http_server.listen(5000)
def path_count(x, y):
def c_iter(x, y, acc):
return acc if x <= 0 or y <= 0 else c_iter(x - 1, y, acc + path_count(x, y -1))
return c_iter(x, y, 1)
if __name__ == '__main__':
print path_count(2, 2)
@lyoe
lyoe / gist:3930284
Created October 22, 2012 08:18
add random salt for md5 password
#!/usr/bin/env python
#coding:utf-8
import random
import hashlib
DIGEST_LEN = 16
def generate(password):
salt = '%0*d%0*d' % (8, random.randint(0, 99999999), 8, random.randint(0, 99999999))
@lyoe
lyoe / gist:3617774
Created September 4, 2012 06:50
When should we use this script?
import sys
reload(sys)
sys.setdefaultencoding('utf-8')