Skip to content

Instantly share code, notes, and snippets.

@BeRANDON
BeRANDON / fonts.googleapis.com.py
Created April 13, 2017 19:58
html_insert_google_font
<link href='//fonts.googleapis.com/css?family={{ .Site.Params.fontquote }}' rel='stylesheet' type='text/css'>
@BeRANDON
BeRANDON / math.html
Last active April 4, 2017 13:53
js_html_mathjax
<html> <body>
<script type="math/tex; mode=display">i_{t} = g(W_{xi}x_{t} + W_{hi}h_{t-1} + b_{i})</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
</body> </html>
@BeRANDON
BeRANDON / python_pandas_gist.py
Created March 30, 2017 17:55
python_pandas_gist
import pandas
import os
# Make tmp output directory.
dir_tmpout = './tmpout'
dir_tmpout = os.path.abspath(dir_tmpout)
if not os.path.isdir(dir_tmpout):
os.mkdir(dir_tmpout)
@BeRANDON
BeRANDON / python.msvcrt.keyboard_interrupt.py
Last active April 3, 2017 07:02
python_detect_keypress
import msvcrt
import time
# asks whether a key has been acquired
def kbfunc():
#this is boolean for whether the keyboard has bene hit
x = msvcrt.kbhit()
if x:
#getch acquires the character encoded in binary ASCII
ret = msvcrt.getch()
@BeRANDON
BeRANDON / python.time
Last active April 3, 2017 07:03
python_milliseconds
import time
time.sleep(3)
millis = int(round(time.time() * 1000))
print(millis)
@BeRANDON
BeRANDON / python.multiprocessing
Last active April 3, 2017 07:04
python_MultiProcess
from multiprocessing import Pool
import os, time, random
def long_time_task(name):
while(1):
print('Run task %s (%s)..' % (name, os.getpid()))
start = time.time()
time.sleep(random.random() * 3)
end = time.time()
print('Task %s runs %0.2f seconds.' % (name, (end - start)))
@BeRANDON
BeRANDON / js_canvas
Last active April 3, 2017 07:05
js_drawImage_via_canvas
<body onresize="resize_canvas()">
<img class=" fit" src="image/shortcut_chrome.png" />
<canvas id="myCanvas" background="image/shortcut_chrome.png"></canvas>
<script type="text/javascript">
function resize_canvas(){
canvas = document.getElementById("myCanvas");
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}
@BeRANDON
BeRANDON / gist_template.py
Last active April 24, 2017 07:23
python_template
#!python
import requests
import time
import json
a = {
'aa':'keyaaa',
'bb':'keybbb'}