Skip to content

Instantly share code, notes, and snippets.

View vst's full-sized avatar
😳

Vehbi Sinan Tunalioglu vst

😳
View GitHub Profile
from enum import Enum
from decimal import Decimal
class Currency:
"""
Defines an ISO 4217 compatible currency object model.
>>> Currency("XXX", "My Currency", 2)
<Currency XXX 2 My Currency>
from enum import Enum
from math import inf
class Multiplicity(Enum):
"""
Defines multiplicities.
>>> Multiplicity.OPTIONAL.min
0
import org.moeaframework.core.Algorithm;
import org.moeaframework.core.Solution;
import org.moeaframework.core.spi.AlgorithmFactory;
import org.moeaframework.core.variable.Grammar;
import org.moeaframework.problem.AbstractProblem;
import org.moeaframework.util.grammar.ContextFreeGrammar;
import org.moeaframework.util.grammar.Parser;
import org.renjin.sexp.SEXP;
import javax.script.ScriptEngine;
from collections import OrderedDict
import base64
import json
import urllib2
import sys
import datetime
## Define Bitbucket API endpoints:
ENDPOINT_REPOSITORIES = "https://api.bitbucket.org/2.0/repositories/{handle}?page={page}"
@vst
vst / document.tex
Created October 23, 2012 10:21
LaTeX Template for starting documents quickly
%% Set the overall document-class properties:
\documentclass[12pt,a4paper]{article}
%% Use and configure packages:
\usepackage{color}
\usepackage[T1]{fontenc}
\usepackage[top=3cm,left=2.5cm,right=2.5cm,bottom=3cm]{geometry}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{palatino}
@vst
vst / cftmc.csv
Created September 5, 2012 04:51
Month Codes for Constructing Commodities Futures Tickers
no name abbr code
1 january jan F
2 february feb G
3 march mar H
4 april apr J
5 may may K
6 june jun M
7 july jul N
8 august aug Q
9 september sep U
@vst
vst / Rprofile.R
Created February 8, 2012 06:02
My .Rprofile
## Increase the width for wider screens:
options("width"=140)
## Change the prompt:
options(prompt="R> ")
## Set digits to 4 while printing:
options(digits=4)
## Set penalty for scientific notation while printing:
@vst
vst / remoteSource.R
Created February 8, 2012 03:30
Retrieves and evaluates remote R sources including those served over secure http (https) connections. Requires RCurl package.
##' Retrieves and evaluates a remote R source file.
##'
##' @param file defines a URL as the remote source file path
##' @param local indicates if the remote source should be evaluated in
##' the environment which calls remoteSource. If FALSE (default),
##' evaluated in the global environment.
##' @param verbose indicates if verbose output should be printed.
##' @param echo indicates if the source should be echoed before
##' evaluation.
##' @return result of evaluating the remote source.
@vst
vst / sg.csv
Created February 8, 2012 03:02
CSV file of Singapore districts. "code" refers to district code, "name" to district name, and "zips" to the first to characters of the zipcodes belonging to the particular district.
code name zips
1 Raffles Place, Cecil, Marina, People's Park 01
1 Raffles Place, Cecil, Marina, People's Park 02
1 Raffles Place, Cecil, Marina, People's Park 03
1 Raffles Place, Cecil, Marina, People's Park 04
1 Raffles Place, Cecil, Marina, People's Park 05
1 Raffles Place, Cecil, Marina, People's Park 06
2 Anson, Tanjong Pagar 07
2 Anson, Tanjong Pagar 08
3 Queenstown, Tiong Bahru 14
@vst
vst / parseEBSstatement.py
Created January 11, 2012 05:38
Parses an EBS statement retrieved from secure.ebs.in and produces a simpler representation for bank account management.
##############################################################################
# Copyright 2012 Vehbi Sinan Tunalioglu #
# #
# 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 #