Skip to content

Instantly share code, notes, and snippets.

View hailiang-wang's full-sized avatar
🌴
On vacation

Hai Liang W. hailiang-wang

🌴
On vacation
View GitHub Profile
@hailiang-wang
hailiang-wang / conditionalformatting.py
Created February 21, 2023 03:19 — forked from pythonexcels/conditionalformatting.py
Conditional Formatting in Excel using Python
#
# conditionalformatting.py
# Create two tables and apply Conditional Formatting
#
import win32com.client as win32
excel = win32.gencache.EnsureDispatch('Excel.Application')
#excel.Visible = True
wb = excel.Workbooks.Add()
ws = wb.Worksheets('Sheet1')
ws.Range("B2:K2").Value = [i for i in range(1,11)]
@hailiang-wang
hailiang-wang / generate-ssh-key
Created September 28, 2022 11:52 — forked from hongkongkiwi/generate-ssh-key
Simple one liner to generate an SSH key without a password in the default place with the comment as hostname then print out the public key for copy and paste.
HOSTNAME=`hostname` ssh-keygen -t rsa -C "$HOSTNAME" -f "$HOME/.ssh/id_rsa" -P "" && cat ~/.ssh/id_rsa.pub
@hailiang-wang
hailiang-wang / gcash2ledger.py
Created December 27, 2021 04:10 — forked from nonducor/gcash2ledger.py
A simple script to convert an (uncompressed) gnucash XML file to the ledger-cli format
#! /usr/bin/python3
import os
import sys
import dateutil.parser
import xml.etree.ElementTree
nss = {'gnc': 'http://www.gnucash.org/XML/gnc',
'act': 'http://www.gnucash.org/XML/act',
'book': 'http://www.gnucash.org/XML/book',
; Recommended for performance and compatibility with future AutoHotkey releases.
#NoEnv
; Recommended for catching common errors.
#Warn
; There's no reason to run this script more than once
#SingleInstance force
;; memo hotkey shortcuts
@hailiang-wang
hailiang-wang / fork forced sync
Created October 5, 2021 01:33 — forked from glennblock/fork forced sync
Force your forked repo to be the same as upstream.
git fetch upstream
git reset --hard upstream/master
@hailiang-wang
hailiang-wang / emulator-install-using-avdmanager.md
Created October 1, 2021 09:21 — forked from mrk-han/emulator-install-using-avdmanager.md
Installing and creating Emulators with AVDMANAGER (For Continuous Integration Server or Local Use)

Install and Create Emulators using AVDMANAGER and SDKMANAGER

TL;DR

For generic skin emulator with default apis (without google apis):

  1. List All System Images Available for Download: sdkmanager --list | grep system-images

  2. Download Image: sdkmanager --install "system-images;android-29;default;x86"

@hailiang-wang
hailiang-wang / kyteapos2en.pl
Created July 1, 2021 06:12 — forked from neubig/kyteapos2en.pl
A program to change KyTea's Japanese POS tags to english tags
#!/usr/bin/perl
# This is a script to change KyTea's POS tags in Japanese to English
# abbreviations
use strict;
use utf8;
use Getopt::Long;
use List::Util qw(sum min max shuffle);
binmode STDIN, ":utf8";
binmode STDOUT, ":utf8";
@hailiang-wang
hailiang-wang / Install NVIDIA Driver and CUDA.md
Created June 21, 2019 03:24 — forked from wangruohui/Install NVIDIA Driver and CUDA.md
Install NVIDIA Driver and CUDA on Ubuntu / CentOS / Fedora Linux OS
@hailiang-wang
hailiang-wang / gist:2c935182fb7213205284f7cd5040536a
Created February 22, 2018 03:49 — forked from syllog1sm/gist:10343947
A simple Python dependency parser
"""A simple implementation of a greedy transition-based parser. Released under BSD license."""
from os import path
import os
import sys
from collections import defaultdict
import random
import time
import pickle
SHIFT = 0; RIGHT = 1; LEFT = 2;
@hailiang-wang
hailiang-wang / clusterdump.sh
Created October 24, 2017 10:10 — forked from zviri/clusterdump.sh
Mahout cheat-sheet
mahout clusterdump \
-dt sequencefile \ # format: {Integer => String}
-d reuters-vectors/dictionary.file-* \ # dictionary: {id => word}
-i reuters-kmeans-clusters/clusters-3-final \ # input
-o clusters.txt \ # output (local filesystem)
-b 10 \ # format length
-n 10 # number of top terms to print
--distanceMeasure org.apache.mahout.common.distance.CosineDistanceMeasure # default is euclidean distance