Skip to content

Instantly share code, notes, and snippets.

View yiwang's full-sized avatar

Yi Wang yiwang

View GitHub Profile
@yiwang
yiwang / arch-linux-install
Created August 2, 2017 13:36 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
@yiwang
yiwang / nixos.md
Created August 2, 2017 13:35 — forked from martijnvermaat/nixos.md
Installation of NixOS with encrypted root
@yiwang
yiwang / gpg-import-and-export-instructions.md
Created April 25, 2017 01:51 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

Verifying that "yiwang.id" is my Blockstack ID. https://onename.com/yiwang

Keybase proof

I hereby claim:

  • I am yiwang on github.
  • I am yi (https://keybase.io/yi) on keybase.
  • I have a public key ASCPfqDvFkqNVjzlcj0TAHfB6UZHi2GNE57tLu9AtIECqQo

To claim this, I am signing this object:

@yiwang
yiwang / brew-java-and-jenv.md
Created March 17, 2017 17:53 — forked from tomysmile/brew-java-and-jenv.md
How To Install Java 8 on Mac

Install HomeBrew first

brew update
brew tap caskroom/cask
brew install brew-cask

If you get the error "already installed", follow the instructions to unlink it, then install again:

@yiwang
yiwang / .git_hooks_pre-commit
Created February 16, 2017 19:08 — forked from leucos/.git_hooks_pre-commit
ansible-vault pre-commit hook
#!/bin/sh
#
# Pre-commit hook that verifies if all files containing 'vault' in the name
# are encrypted.
# If not, commit will fail with an error message
#
# Original author: @ralovely
# https://www.reinteractive.net/posts/167-ansible-real-life-good-practices
#
# File should be .git/hooks/pre-commit and executable
@yiwang
yiwang / emr_bootstrap_java_8.sh
Created February 15, 2017 15:50 — forked from ericeijkelenboom/emr_bootstrap_java_8.sh
Bootstrap script for installing Java 8 on an Amazon Elastic MapReduce instance (AMI 3.0.1)
# Check java version
JAVA_VER=$(java -version 2>&1 | sed 's/java version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q')
if [ "$JAVA_VER" -lt 18 ]
then
# Download jdk 8
echo "Downloading and installing jdk 8"
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8-b132/jdk-8-linux-x64.rpm"
# Silent install
@yiwang
yiwang / airflow_deploy_design.md
Created February 10, 2017 19:33 — forked from rampage644/airflow_deploy_design.md
Airflow flows deployment

Introduction

This document describes how Airflow jobs (or workflows) get deployed onto production system.

Directory structure

  • HOME directory:/home/airflow
  • DAG directory: $HOME/airflow-git-dir/dags/
  • Config directory: $HOME/airflow-git-dir/configs/
  • Unittest directore: $HOME/airflow-git-dir/tests/. Preferable, discoverable by both nose and py.test
  • Credentials should be accessed by by some library
@yiwang
yiwang / DataFrameFunctions.scala
Created September 1, 2016 18:30 — forked from ssimeonov/DataFrameFunctions.scala
Querying DataFrame with SQL without explicit registration of a temporary table
object DataFrameFunctions {
final val TEMP_TABLE_PLACEHOLDER = "~tbl~"
/** Executes a SQL statement on the dataframe.
* Behind the scenes, it registers and cleans up a temporary table.
*
* @param df input dataframe
* @param stmtTemplate SQL statement template that uses the value of
* `TEMP_TABLE_PLACEHOLDER` for the table name.