Skip to content

Instantly share code, notes, and snippets.

View zcaudate's full-sized avatar

Chris Zheng zcaudate

View GitHub Profile
@zcaudate
zcaudate / DYLD_LIBRARY_PATH
Created August 20, 2018 14:17 — forked from Brideau/DYLD_LIBRARY_PATH
Install GDAL with Java bindings on macOS High Sierra
export DYLD_LIBRARY_PATH=/usr/local/opt/gdal2/lib:$DYLD_LIBRARY_PATH
@zcaudate
zcaudate / HotSpot JVM intrinsics
Created August 15, 2020 14:33 — forked from apangin/HotSpot JVM intrinsics
HotSpot JVM intrinsics
_hashCode java/lang/Object.hashCode()I
_getClass java/lang/Object.getClass()Ljava/lang/Class;
_clone java/lang/Object.clone()Ljava/lang/Object;
_dabs java/lang/Math.abs(D)D
_dsin java/lang/Math.sin(D)D
_dcos java/lang/Math.cos(D)D
_dtan java/lang/Math.tan(D)D
_datan2 java/lang/Math.atan2(DD)D
_dsqrt java/lang/Math.sqrt(D)D
_dlog java/lang/Math.log(D)D
@zcaudate
zcaudate / create-mint-sh
Last active January 31, 2021 05:51 — forked from gildas/create-mint-sh
Create Linux Mint USB on Mac OS/X
#! /usr/bin/env bash
# Insert a USB key.
# if needed initialize it with MS/DOS FAT and MBR
# Download the Mint ISO image
# Convert the ISO -> IMG
hdiutil convert -format UDRW -o linuxmint-20.1-cinnamon-64bit linuxmint-20.1-cinnamon-64bit.iso
# Check where the USB drive has been mounted
@zcaudate
zcaudate / homebrew-mirror-in-china.sh
Created February 18, 2021 12:31 — forked from shrekuu/homebrew-mirror-in-china.sh
homebrew 中国镜像服务, 清华大学与中科大
# 清华大学:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
# 手动修改 bottles 地址:
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
# 或:
@zcaudate
zcaudate / redis.markdown
Created April 23, 2021 06:53 — forked from bdotdub/redis.markdown
Running redis using upstart on Ubuntu

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

@zcaudate
zcaudate / itertools.js
Created November 19, 2021 10:02 — forked from archanpatkar/itertools.js
Using ES6 Generator prototype model to implement lazy chaining. When you set the prototype of multiple Generator Functions to a common prototype you can chain them. Examples at the bottom. (this code currently only works in Firefox Aurora, but will eventually work in all JS engines).
const module = { exports: {} };
let exports = module.exports;
const GeneratorFunction = function*(){}.constructor;
const iteratorSymbol = (typeof Symbol === "function" && Symbol.iterator) || "@@iterator";
const MISSING = {};
/**
* A generator function is always called as a constructor. If multiple
* generators share the same prototype, and you put generators on that shared
@zcaudate
zcaudate / letsencrypt-guide-nginx-acme.sh.md
Created November 20, 2022 13:06 — forked from dorelljames/letsencrypt-guide-nginx-acme.sh.md
SSL via Let's Encrypt (nginx server)

Nginx SSL via Let's Encrypt and acme.sh

This guide is intended to walk you through installation of a valid SSL on your server for your site at example.com. This example is using root user, you may need to use sudo if you encounter problems such as write permissions.

Pre-requisites

  • Install acme.sh on your server. This will create a acme.sh folder in your home directory and more importantly create an everyday cron job to check and renew certificates if needed.
  • Install nginx server (different per distibution so just make sure you have it up and running)