Skip to content

Instantly share code, notes, and snippets.

View alitrack's full-sized avatar

Steven Lee alitrack

View GitHub Profile
@alitrack
alitrack / example.py
Created August 8, 2021 00:50
modified version of trees.py (part of [parrt/dtreeviz](https://github.com/parrt/dtreeviz))
# to test this example, make sure you have font Arial Unicode MS(Arial Unicode.ttf) installed.
from sklearn.datasets import *
from sklearn import tree
from dtreeviz.trees import *
classifier = tree.DecisionTreeClassifier(max_depth=3) # limit depth of tree
iris = load_iris()
classifier.fit(iris.data, iris.target)
# the following two line codes are just for Chinese test.
@alitrack
alitrack / build-only-aubio_i686-w64-mingw32.static.log
Created June 9, 2020 14:43
NameError: global name 'md5' is not defined make[1]: *** [build-only-aubio_i686-w64-mingw32.static] Error 2
[warning] **gettext-0.20.1**
uname -a
Darwin Stevens-MBP.lan 19.3.0 Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64
git log --pretty=tformat:"%H - %s [%ar] [%d]" -1
1ee37f8e0a949f033603a9657f32d81aa1a56e52 - Update packages.json & build-matrix.html [4 hours ago] [ (HEAD -> master, origin/master, origin/HEAD)]
lsb_release -a 2>/dev/null || sw_vers 2>/dev/null || true
ProductName: Mac OS X
ProductVersion: 10.15.3
BuildVersion: 19D76
autoconf --version 2>/dev/null | head -1
@alitrack
alitrack / aubio_i686-w64-mingw32.static.log
Created June 9, 2020 03:26
aubio_i686-w64-mingw32.static mxe log under Mac OS
[plugin] /Users/steven/mxe/plugins/native/darwin/
uname -a
Darwin Stevens-MacBook-Pro.local 19.3.0 Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64
git log --pretty=tformat:"%H - %s [%ar] [%d]" -1
60b660aae99a4fcdff275f81569cc543aec9f5d3 - Update packages.json & build-matrix.html [6 days ago] [ (HEAD -> master, origin/master, origin/HEAD)]
lsb_release -a 2>/dev/null || sw_vers 2>/dev/null || true
ProductName: Mac OS X
ProductVersion: 10.15.3
BuildVersion: 19D76
autoconf --version 2>/dev/null | head -1
@alitrack
alitrack / glib_x86_64-apple-darwin19.3.0
Created May 23, 2020 14:09
make[1]: *** [build-only-glib_x86_64-apple-darwin19.3.0] Error 1
uname -a
Darwin Stevens-MBP.lan 19.3.0 Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64
git log --pretty=tformat:"%H - %s [%ar] [%d]" -1
76375b2bccbbf409aaab44d4fc0cbd017c5a00e3 - Update packages.json & build-matrix.html [5 days ago] [ (HEAD -> master, origin/master, origin/HEAD)]
lsb_release -a 2>/dev/null || sw_vers 2>/dev/null || true
ProductName: Mac OS X
ProductVersion: 10.15.3
BuildVersion: 19D76
autoconf --version 2>/dev/null | head -1
autoconf (GNU Autoconf) 2.69
@alitrack
alitrack / customer-segmentation.py
Created May 3, 2017 08:37 — forked from glamp/customer-segmentation.py
Analysis for customer segmentation blog post
import pandas as pd
# http://blog.yhathq.com/static/misc/data/WineKMC.xlsx
df_offers = pd.read_excel("./WineKMC.xlsx", sheetname=0)
df_offers.columns = ["offer_id", "campaign", "varietal", "min_qty", "discount", "origin", "past_peak"]
df_offers.head()
df_transactions = pd.read_excel("./WineKMC.xlsx", sheetname=1)
df_transactions.columns = ["customer_name", "offer_id"]
df_transactions['n'] = 1
df_transactions.head()
@alitrack
alitrack / pgAdmin4.sh
Last active November 12, 2016 09:03
How to compile and run pgAdmin4 in Serve mode
sudo pip install virtualenvwrapper
virtualenv pgadmin4
cd pgadmin4/
source bin/activate
wget https://ftp.postgresql.org/pub/pgadmin3/pgadmin4/v1.1/source/pgadmin4-1.1.tar.gz
tar xf pgadmin4-1.1.tar.gz
cd pgadmin4-1.1/
# -*- coding: utf-8 -*-
#encoding=utf-8
import urllib2
import sys, json
from StringIO import StringIO
import gzip
import MySQLdb
import datetime
@alitrack
alitrack / xlsx2psql.r
Created August 11, 2016 14:33
PostgreSQL
library(readxl, quietly=TRUE)
df <- read_excel("d:/my.xlsx",col_names = TRUE)
library(RPostgreSQL)
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, user='postgres', password='', dbname='alitrack', host='postgres.alitrack.com')
postgresqlpqExec(con, "SET client_encoding = 'GBK'")
dbWriteTable(con, c("my_schema","my_table"), data.frame(df), row.names = FALSE)