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
@tiye
tiye / caret.coffee
Last active April 7, 2020 04:24
Small script to detect caret pixel position in contenteditable div
getCaretTopPoint = ->
sel = document.getSelection()
r = sel.getRangeAt(0)
# supposed to be textNode in most cases
# but div[contenteditable] when empty
node = r.startContainer
offset = r.startOffset
if offset > 0
@chezou
chezou / visword2vec.py
Last active December 2, 2020 20:52
Visualizer word2vec data for ipython notebook
# -*- coding: utf-8 -*-
"""
given a word and visualize near words
original source code is https://github.com/nishio/mycorpus/blob/master/vis.py
"""
import word2vec_boostpython as w2v
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
import matplotlib.font_manager
@pirafrank
pirafrank / uninstall_office_2016.sh
Last active March 21, 2024 14:12
Uninstall Office 2016 from OS X completely
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo -e "
ROOT PRIVILEDGES NEEDED!
You have to run this script as root.
Aborting...
"
exit 1
else
@stayradiated
stayradiated / img2vid
Last active January 11, 2024 15:33
Concatenate Videos and Images using ffmpeg
#!/usr/bin/env bash
#
# img2vid
# =======
#
# Convert an image into three second video
#
# Usage: ./img2vid photo.jpg video.mp4
#
@nonducor
nonducor / gcash2ledger.py
Last active September 12, 2023 06:10
A simple script to convert an (uncompressed) gnucash XML file to the ledger-cli format
#! /usr/bin/python3
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# (1) Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# (2) Redistributions in binary form must reproduce the above copyright
@mrk-han
mrk-han / emulator-install-using-avdmanager.md
Last active May 28, 2024 20:30
Installing and creating Emulators with AVDMANAGER (For Continuous Integration Server or Local Use)

Install and Create Emulators using AVDMANAGER and SDKMANAGER

TL;DR

For an emulator that mimics a Pixel 5 Device with Google APIs and ARM architecture (for an M1/M2 Macbook):

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

  2. Download Image: sdkmanager --install "system-images;android-30;google_atd;arm64-v8a"

Windows 10 - Using Git Bash With TMUX

Why Not Use WSL?

I tried the WSL and it isn't quite seamless enough for me. I ran in to problems when editing in VSCode and having watchers on my files (ng serve, dotnet watch run, etc.). In addition, I kept running in to problems that only manifest themselves when running in WSL. For example, this issue with doing production builds and the terser plugin has made many a developer rage-quit on using WSL. Just figuring out that it was an issue with the WSL took a lot of time.

That terser plugin issue was never resolved and I ended up having to keep a git bash window open in addition to my WSL console window so I could do production builds. To make matters worse, my npm packages were platform-dependent so I couldn't use the same project folder. So, my procedure was: commit whatever changes to test branch, push to repo, git pull on my "windows" project folder, and do a production build there