Skip to content

Instantly share code, notes, and snippets.

View Silverneo's full-sized avatar
🔆
Working

Chunmeng Silverneo

🔆
Working
  • Singapore
View GitHub Profile
@jovianlin
jovianlin / SVY21.py
Last active November 25, 2022 10:49
Singapore has a special coordinate system called SVY21. This converts the special coordinates to lat/lng.
#! /usr/bin/python
import math
class SVY21:
# Ref: http://www.linz.govt.nz/geodetic/conversion-coordinates/projection-conversions/transverse-mercator-preliminary-computations/index.aspx
# WGS84 Datum
a = 6378137
f = 1 / 298.257223563
@Nikolay-Lysenko
Nikolay-Lysenko / xgb_quantile_loss.py
Last active October 25, 2023 13:26
Customized loss function for quantile regression with XGBoost
import numpy as np
def xgb_quantile_eval(preds, dmatrix, quantile=0.2):
"""
Customized evaluational metric that equals
to quantile regression loss (also known as
pinball loss).
Quantile regression is regression that
@btel
btel / install_orange_on_anaconda.sh
Last active February 20, 2018 15:00
install orange3 (http://orange.biolab.si/) with anaconda
conda create -n orange python=3.4 numpy scipy scikit-learn docutils beautifulsoup4 nose Sphinx xlrd pyqt psycopg2
source activate orange
pip install bottlechest
pip install chardet
pip install recommonmark
pip install pyqtgraph
pip install qt-graph-helpers
git clone https://github.com/biolab/orange3.git
@kachayev
kachayev / dijkstra.py
Last active April 14, 2024 06:58
Dijkstra shortest path algorithm based on python heapq heap implementation
from collections import defaultdict
from heapq import *
def dijkstra(edges, f, t):
g = defaultdict(list)
for l,r,c in edges:
g[l].append((c,r))
q, seen, mins = [(0,f,())], set(), {f: 0}
while q:
@tj
tj / git aliases.sh
Last active January 14, 2024 10:37
Some helpful git aliases
alias gd="git diff"
alias gc="git clone"
alias ga="git add"
alias gbd="git branch -D"
alias gst="git status"
alias gca="git commit -a -m"
alias gpt="git push --tags"
alias gp="git push"
alias gpr="git pull-request"
alias grh="git reset --hard"
@chadhutchins
chadhutchins / gist:1440602
Created December 6, 2011 23:36
Tarjan's strongly connected components algorithm in Javascript - followed pseudocode from http://en.wikipedia.org/wiki/Tarjan%E2%80%99s_strongly_connected_components_algorithm
window.onload = function() {
var v0 = new Vertex("0");
var v1 = new Vertex("1");
var v2 = new Vertex("2");
var v3 = new Vertex("3");
var v4 = new Vertex("4");
var v5 = new Vertex("5");
var v6 = new Vertex("6");
var v7 = new Vertex("7");