Skip to content

Instantly share code, notes, and snippets.

View xiamaz's full-sized avatar
🚩
Semaphoring

Max Xiaohang Zhao xiamaz

🚩
Semaphoring
View GitHub Profile
@xiamaz
xiamaz / cloudflare.service
Created December 17, 2019 18:06
Cloudflare dynamic dns (dyndns) update script
[Unit]
Description=Update Cloudflare IP periodically.
[Service]
Type=oneshot
ExecStart=/usr/local/bin/cloudflare.sh
@xiamaz
xiamaz / configure_ubuntu.sh
Last active October 2, 2018 22:03
Automatic setup of nvidia docker and some convenience features on Ubuntu 16.04
#!/bin/sh
APPLICATIONS="$HOME/Apps"
mkdir -p $APPLICATIONS
LOCALBIN="$HOME/.local/bin"
mkdir -p $LOCALBIN
install_fun() {
prog=$1
if ! command -v $1 > /dev/null; then
echo "$1 is not available. Trying to install it."
@xiamaz
xiamaz / skopeo_ecr.fish
Last active June 22, 2018 10:52
Login to ECR in Skopeo
skopeo inspect --creds=AWS:( aws ecr get-login | grep -Po '(?<=\-p )\w+') docker://<REGISTRY_URL>
@xiamaz
xiamaz / flow_transform_fragment.py
Last active May 28, 2018 09:45
Use $PnE data for flow cytometry data loaded with fcsparser to transform linearized log marker channels according to FCS3.1 specification
# code snipplet to implement PnE based transformation of flow data in python
data = FCSLogTransform().transform(data)
def logTransform(data):
transCols = [c for c in data.columns if "LIN" not in c]
for col, f in channel_info.items():
if f["f1"]:
data[col] = 10 ** (f["f1"] * data[col] / f["range"]) * f["f2"]
print(transCols)
print(data.min(axis=0), data.max(axis=0))
data[transCols] = np.log10(data[transCols])
@xiamaz
xiamaz / createFlowFrame.R
Created November 3, 2017 14:45 — forked from yannabraham/createFlowFrame.R
A quick way to create FCS files from CSV
library(Biobase)
library(flowCore)
library(flowViz)
# simply replace the dummy dta below with your CSV data
dta <- matrix(rnorm(10000),ncol=10)
dimnames(dta)[[2]] <- LETTERS[1:10]
head(dta)
@xiamaz
xiamaz / PKGBUILD
Last active August 12, 2017 13:22
Fix curlbuild error in polybar
# Maintainer: Michael Carlberg <c@rlberg.se>
# Contributor: Michael Carlberg <c@rlberg.se>
pkgname=polybar
pkgver=3.0.5
pkgrel=2
pkgdesc="A fast and easy-to-use status bar"
arch=("i686" "x86_64")
url="https://github.com/jaagr/polybar"
license=("MIT")
depends=("cairo" "xcb-util-image" "xcb-util-wm" "xcb-util-xrm")

Keybase proof

I hereby claim:

  • I am xiamaz on github.
  • I am alcasa (https://keybase.io/alcasa) on keybase.
  • I have a public key ASDKMRpqtSEoDTIhNxnQb9i1k4iUIFymuJtSLZWm72is4wo

To claim this, I am signing this object:

@xiamaz
xiamaz / Blockchain.bib
Created February 2, 2017 00:34
Blockchain Theory Text
@article{satoshi,
title = {Bitcoin: A peer-to-peer electronic cash system},
url = {http://www.cryptovest.co.uk/resources/Bitcoin%20paper%20Original.pdf},
shorttitle = {Bitcoin},
author = {Nakamoto, Satoshi},
urldate = {2017-02-01},
date = {2008},
file = {[PDF] cryptovest.co.uk:/home/max/.mozilla/firefox/jeyuln4l.default/zotero/storage/JRRGC7JA/Nakamoto - 2008 - Bitcoin A peer-to-peer electronic cash system.pdf:application/pdf}
}