Skip to content

Instantly share code, notes, and snippets.

View guenp's full-sized avatar

Guen Prawiroatmodjo guenp

View GitHub Profile
@guenp
guenp / mog.py
Created July 26, 2016 21:20 — forked from colinclement/mog.py
Fit data like spectra or something to a sum of gaussians.
"""
mog.py
Mixture of gaussians. For fitting data that looks like Gaussians.
author: Colin Clement
date: 2016-2-29
"""
@guenp
guenp / iterm2-solarized.md
Created August 31, 2017 11:18 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@guenp
guenp / message.hpp
Created September 27, 2017 18:12 — forked from mashiro/message.hpp
zeromq + msgpack
#include <string>
#include <ctime>
#include <msgpack.hpp>
struct message
{
std::string tag;
std::time_t time;
std::string text;
MSGPACK_DEFINE(tag, time, text);
@guenp
guenp / pyenv.sh
Created October 19, 2017 17:43 — forked from stevenheidel/pyenv.sh
Using pyenv
# INSTALLATION
# Step 1: Install pyenv
curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
# This will output some instructions to add a few lines to
# your ~/.bash_profile file. Once you've done that
# then open a new terminal window to continue.
# Step 2: Install some versions of Python
# This will take a few minutes
@guenp
guenp / design_docke_template.md
Last active October 22, 2018 19:18
Design Doc Template

Design Doc Title

Stakeholders

List stakeholders for project/feature.

Role Person
Dev Owner
Other Dev 1 (Engine)
@guenp
guenp / nginxproxy.md
Created December 21, 2018 22:49 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@guenp
guenp / timed_cache.py
Created January 7, 2019 21:00 — forked from Morreski/timed_cache.py
Python lru_cache with timeout
from datetime import datetime, timedelta
import functools
def timed_cache(**timedelta_kwargs):
def _wrapper(f):
update_delta = timedelta(**timedelta_kwargs)
next_update = datetime.utcnow() - update_delta
# Apply @lru_cache to f with no cache size limit
@guenp
guenp / nginx.conf
Created January 11, 2019 01:54 — forked from zonca/nginx.conf
Jupyterhub NGINX reverse proxy with SSL, replace HOSTNAME with a hostname or _
ser www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
@guenp
guenp / Makefile
Created January 30, 2019 18:58 — forked from mpneuried/Makefile
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
@guenp
guenp / simple_args_parsing.sh
Created May 25, 2019 00:25 — forked from jehiah/simple_args_parsing.sh
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"