Skip to content

Instantly share code, notes, and snippets.

View u2386's full-sized avatar
:octocat:
Code Addict

u2386 u2386

:octocat:
Code Addict
View GitHub Profile
@u2386
u2386 / .zshrc
Created March 6, 2021 08:26
My dotzshrc
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
bindkey -e
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '$HOME/.zshrc'
autoload -Uz compinit
@u2386
u2386 / ring.erl
Last active February 22, 2019 15:53
Solution to 8.11 Problem 2 in _Programming Erlang: Software for a Concurrent World_
% Write a ring benchmark. Create N processes in a ring. Send a mes- sage round the
% ring M times so that a total of N * M messages get sent. Time how long this takes
% for different values of N and M.
-module(ring).
-author(hugo).
-export([create_ring/2, benchmark/2]).
benchmark(N, M) ->
statistics(runtime),
@u2386
u2386 / dynamic_func.go
Created July 22, 2018 07:03
Dynamic go function using reflect
package main
import (
"fmt"
"reflect"
)
func main() {
# coding: utf-8
class A(list):
def __call__(self):
return "Good"
class B(object):
from copy import deepcopy
def copy(entity):
return deepcopy(entity)
def get_start(l, n):
"""Get a root entity.
@u2386
u2386 / update_CourseCategory.py
Created March 24, 2015 00:36
Update web WD-ENG collection CourseCategory database.
# coding:utf-8
import datetime
import os
from pymongo import MongoClient
def insert_node(post_to, name, code, level, parent, describe=""):
"""
post a node
:param post_to: collection