Skip to content

Instantly share code, notes, and snippets.

View nyanshell's full-sized avatar
🐈

Gestalt LUR nyanshell

🐈
View GitHub Profile
@nyanshell
nyanshell / compare.py
Created March 17, 2014 08:49
A test: using google sparse hash in python script
dict()
for i in range(0, 10000000):
d[str(i)] = i + 1
@nyanshell
nyanshell / timus_1022.py
Created March 23, 2014 14:08
simple topological sort
#!/usr/bin/python3
"""
TIMUS 1022
ACCEPTED
2014-03-23
"""
q = set()
n = int(input())
@nyanshell
nyanshell / .emacs
Created March 25, 2014 17:14
emacs configure home
;;load path
(add-to-list 'load-path "/home/gestapolur/.emacs.d/lisp/")
;;tree view
(autoload 'dirtree "dirtree" "Add directory to tree view" t)
(require 'dirtree)
(require 'tree-mode)
(require 'windata)
(require 'twittering-mode)
(custom-set-variables
@nyanshell
nyanshell / timus_1008.py
Created April 8, 2014 16:43
timus_1008.py
#!/usr/bin/python2.7
"""
TIMUS 1008
ACCEPTED
2014-04-09
"""
# init
@nyanshell
nyanshell / crypt.sh
Last active August 29, 2015 14:04
a simple script to save password in truecrypt container
#!/bin/bash
# a simple script to save password in truecrypt container
passwd_key= passwd_value= passwd_pair_str=
while [ $# -gt 0 ]
do
case $1 in
-i) passwd_key=$2
passwd_value=$3
@nyanshell
nyanshell / convert.py
Created October 18, 2014 08:32
Convert xlsx to csv in a directory
#!/bin/python3
# -*- coding: utf-8 -*-
"""
xlsx2csv may have some issues while converting datetime
"""
import xlsx2csv
from glob import glob
@nyanshell
nyanshell / convert_to_xlsx.py
Created October 20, 2014 04:45
convert csv to xlsx
import glob
import csv
from xlsxwriter.workbook import Workbook
for csvfile in glob.glob("/data"):
workbook = Workbook(csvfile.rsplit(".")[0].split("/", 1)[-1] + '.xlsx')
worksheet = workbook.add_worksheet()
_format = workbook.add_format()
_format.set_pattern(1)
_format.set_bg_color('blue')
@nyanshell
nyanshell / Dockerfile
Last active August 29, 2015 14:08
configuration for mongodb testing environment run in docker
FROM ubuntu:latest
# Add 10gen official apt source to the sources list
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
RUN echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | tee /etc/apt/sources.list.d/10gen.list
# Install MongoDB
RUN apt-get update
RUN apt-get install mongodb-10gen
@nyanshell
nyanshell / mandelbrot.py
Last active August 29, 2015 14:08
A bokeh image embedding sample.
from __future__ import division
import numpy as np
from bokeh.plotting import *
from bokeh.resources import CDN
from bokeh.embed import components
from bottle import run, template, route, jinja2_view
@nyanshell
nyanshell / .bumpversion.cfg
Created November 19, 2014 02:22
.bumpversion.cfg
[bumpversion]
files = setup.py corpus/__init__.py
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(?P<release>.*)
serialize =
{major}.{minor}.{patch}{release}
{major}.{minor}.{patch}
commit = True
tag = True
current_version = 0.3.1a