Skip to content

Instantly share code, notes, and snippets.

View fonylew's full-sized avatar
🐝
Go Jackets!

Kamolphan Lewprasert fonylew

🐝
Go Jackets!
View GitHub Profile
@earldouglas
earldouglas / _README.md
Last active October 3, 2015 22:21
APIcon 2014: Real-World Functional Programming

Real-World Functional Programming

May 28, 2014

This code is a companion to the APIcon presentation Real-World Functional Programming by @jearldouglas and @kelleyrobinson. The slides are available here.

In this code, we compare imperative and functional implementations of a withdraw function that might be used in a banking ATM.

Imperative transactions

#export PATH=$PATH:~/bin
export PATH=/bin:/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:$PATH
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packages
export PATH=${PATH}:$HOME/gsutil
#export EDITOR='subl -w'
alias sl="ls"
alias สห="ls"
alias แก="cd"
alias howmuch="tree .|wc"
alias prettyjson='python -m json.tool'
set relativenumber
set number
colorscheme elflord
filetype plugin indent on
set tabstop=4
set shiftwidth=4
set expandtab
" Allow saving of files as sudo when I forgot to start vim using sudo.
cmap w!! w !sudo tee > /dev/null %
@sebasmagri
sebasmagri / falcon_gevent_streaming.py
Created November 10, 2014 13:08
Concurrently streaming response using Falcon and Gevent
# Fire this using gunicorn falcon_gevent_streaming
# and head to 127.0.0.1:8000 in a browser.
# Requirements:
# pip install falcon gevent
import falcon
import gevent
from gevent.queue import Queue
@igor-panteleev
igor-panteleev / build.py
Created December 7, 2017 10:59
devicehive-video-analysis DarkFlow modifications
# darkflow/net/build.py
def saveckpt(self):
self.saver.save(self.sess, './{}_model.ckpt'.format(self.meta['name']))
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@garethrees
garethrees / readline-cheatsheet.txt
Created May 4, 2016 08:50
Readline Cheatsheet
C = Ctrl
M = Alt
DEL = Backspace
http://www.math.utah.edu/docs/info/features_7.html
Essentials
C-b Move back one character.
C-f Move forward one character.
DEL Delete the character to the left of the cursor.
@chris-jamieson
chris-jamieson / setup.md
Created April 19, 2016 15:43
Set up Franz for Ubuntu
  • Download Franz for your distribution from MeetFranz.com
  • change into the same directory as the downloaded file, then sudo tar -xf Franz-linux-x64-0.9.10.tgz -C /opt/franz
  • (optional) wget "https://cdn-images-1.medium.com/max/360/1*v86tTomtFZIdqzMNpvwIZw.png" -O franz-icon.png then sudo cp franz-icon.png /opt/franz
  • (optional) sudo touch /usr/share/applications/franz.desktop then sudo vim /usr/share/applications/franz.desktop

paste the following lines into the file, then save the file:

[Desktop Entry]
Name=Franz
Comment=
@brbsix
brbsix / mktempenv.sh
Last active August 19, 2020 21:44
mktempenv
# Create a temporary pyenv virtualenv
mktempenv(){
[[ $1 =~ ^(-h|--help)$ ]] && {
echo "Usage: ${FUNCNAME[0]} [VERSION] [NAME]"
echo 'Create a temporary pyenv virtualenv'
return 0
}
local pyenv_version=${1:-$(pyenv version-name)}
local venv_name=${2:-$(mktemp --dry-run -d "tmp-$pyenv_version-XXXXXX")}
@abn
abn / python-flask-task-async.py
Last active February 18, 2021 12:29
A module to facilitate dispatch of asynchronous tasks in a Flask App. This was designed to work standalone in an embedded fashion without dependencies like flask-celery, redis etc. This is not meant to be a reliable means to execute tasks, just a quick and easy solution for most needs.
"""
An asynchronous task manager.
This is a simple implementation for background task handing. No guarentees are
provided for task execution.
This was developed in the course of the work don for the victims project and
that version is available at
https://github.com/victims/victims-web/blob/master/src/victims_web/handlers/task.py