Skip to content

Instantly share code, notes, and snippets.

View femmerling's full-sized avatar
Building things

Fauzan Erich Emmerling femmerling

Building things
View GitHub Profile
femmerling /
Last active October 22, 2020 04:38
This is my workaround for Sanic customized logging information on Gunicorn. I use Gunicorn with Sanic Gunicorn Worker. For this to work you need to add the --capture-output flag in the Gunicorn startup script and setting Sanic's default logging off..
import time
from sanic import Sanic
# `configure_logging=False` will stop Sanic's default logging. You'll use print() for printing to stdout
app = Sanic(name="MyApp", configure_logging=False)
async def embed_start_time(request):
request.ctx.start_time = time.time() # Use requst context `request.ctx` to embed extra information
# run this with python 3
# no external dependencies needed
import random
# initial number of case
initial_case = 2
# number of carrier
carrier = 2
# number of infected
femmerling / .vimrc
Last active January 17, 2024 19:21
vim dotfile
View .vimrc
set encoding=utf-8
set nocompatible " required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
femmerling / initialize.html
Last active April 3, 2017 07:48
Prism Widget Initialization Script
View initialize.html
<div id="prism-widget"></div>
<script src=""></script>
<script type="text/javascript">
(function(e, b, c) {
e.Shamu = {
merchant_id: '',
initialize: function(a) {
a.merchant_id ? this.merchant_id = a.merchant_id : console.log("Shamu: Please initialize Shamu with a merchat_id");
display: function() {
femmerling /
Created June 18, 2016 12:13
Example of MotherNature using default environment
from mothernature import Environment
env = Environment("someyml.yaml", environment='DEV')
femmerling /
Created June 18, 2016 12:10
MotherNature Example without default variable
from mothernature import Environment
env = Environment("config.yml")
# This will provide the config based on the environment you set when starting the application
# and then you can do
femmerling / config.yml
Created June 18, 2016 12:05
Example Yaml file for MotherNature use
View config.yml
DEBUG: false
TESTING: false
DEBUG: true
TESTING: false
femmerling / build.gradle
Created January 29, 2015 10:37
Test module build.gradle
View build.gradle
// fill this with the name of your app in gradle settings
ext.androidProject = 'app'
apply plugin: 'cobertura'
apply plugin: 'com.kageiit.robojava'
cobertura {
coverageFormats = ['html', 'xml']
coverageIgnoreTrivial = true
coverageIgnores = ['org.slf4j.Logger.*']
femmerling / build.gradle
Created January 29, 2015 10:33
App build.gradle
View build.gradle
apply plugin: ''
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "com.emfeld.mvptest"
minSdkVersion 15
targetSdkVersion 21
femmerling / build.gradle
Created January 29, 2015 10:29
project root build.gradle
View build.gradle
buildscript {
repositories {
dependencies {
classpath ''
// this is the robojava plugin
classpath 'com.kageiit:robojava-plugin:1.+'
// this is for cobertura so you have test coverage check
classpath("net.saliman:gradle-cobertura-plugin:2.2.5") {