Skip to content

Instantly share code, notes, and snippets.

View chenchun's full-sized avatar
🦖
go for{vacation()}

Chun Chen chenchun

🦖
go for{vacation()}
View GitHub Profile
@peterroth
peterroth / protobuf-250-on-mac.txt
Created February 18, 2021 10:01
How to install protobuf 2.5.0 on Mac (10.15.7, Catalina). brew required!
brew install automake libtool wget
wget https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.bz2
tar -xvjf protobuf-2.5.0.tar.bz2
cd protobuf-2.5.0
./autogen.sh
./configure
make; make check
sudo make install
Validate the successful installation:
@reinvanoyen
reinvanoyen / terminal-prompt-git-branch-zsh.md
Last active July 20, 2024 21:03
Add Git Branch Name to Terminal Prompt (MacOS zsh)

Add Git Branch Name to Terminal Prompt (zsh)

Updated for MacOS with zsh

  • Catalina
  • Big Sur
  • Monterey
  • Ventura
  • Sonoma

screenshot

@NicholasSterling
NicholasSterling / c_cpp_properties.json
Created November 7, 2018 01:37
Visual Studio Code (vscode) configuration for working with kernel modules on Ubuntu 16.04
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/src/linux-headers-4.15.0-36/include/**",
"/usr/src/linux-headers-4.15.0-36/arch/x86/include/**",
"/usr/src/linux-headers-4.15.0-36-generic/include/**",
"/usr/src/linux-headers-4.15.0-36-generic/arch/x86/include/**"
@douglarek
douglarek / install-openjdk.txt
Last active June 15, 2024 19:20
How to install openJDK 11 on macOS
$ curl -C - https://download.java.net/java/ga/jdk11/openjdk-11_osx-x64_bin.tar.gz -O openjdk-11_osx-x64_bin.tar.gz
$ tar xf openjdk-11_osx-x64_bin.tar.gz
$ sudo mv jdk-11.jdk /Library/Java/JavaVirtualMachines/
$ java -version
openjdk version "11" 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11+28)
OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
@ChenLingPeng
ChenLingPeng / blacklist.yaml
Last active March 25, 2019 03:30
istio-demo
apiVersion: config.istio.io/v1alpha2
kind: listchecker
metadata:
name: whitelist
spec:
# providerUrl: ordinarily black and white lists are maintained
# externally and fetched asynchronously using the providerUrl.
overrides: ["v1", "v2"] # overrides provide a static list
blacklist: false
@innovia
innovia / kubernetes_add_service_account_kubeconfig.sh
Last active January 29, 2024 23:00
Create a service account and generate a kubeconfig file for it - this will also set the default namespace for the user
#!/bin/bash
set -e
set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 <service_account_name> <namespace>"
exit 1
fi
@hex108
hex108 / vps
Last active February 28, 2020 04:46
Manage(start/stop/status) vps on DigitalOcean. You could install shadowsocks automatically when creating a new vps.
#!/bin/bash
set -e
set -u
#set -x
SSH_KEY="05:8b:8f:f5:09:35:ae:61:a9:3b:21:ea:1c:36:bf:0c"
USER_DATA_FILE="$(dirname $0)/vps.userdata"
### sub functions
@stefanfoulis
stefanfoulis / docker_for_mac_disk_default_size.md
Last active June 29, 2023 12:02
How to resize Docker for Mac Disk image and set the default size for new images

Set the default size for new Docker for Mac disk images

UPDATE: The instructions here are no longer necessary! Resizing the disk image is now possible right from the UI since Docker for Mac Version 17.12.0-ce-mac49 (21995).

If you are getting the error: No space left on device

Configuring the qcow2 size cap is possible in the current versions:

# my disk is currently 64GiB
# If you're looking into the C10M problem (10 million concurrent connections)
# you might want to play with DPDK (Originally proprietry Intel, now open source)
#
# C10M: http://c10m.robertgraham.com/
# DPDK: http://dpdk.org/
#
# This is a quick summary how to install dpdk on ubuntu
# running inside virtualbox on a mac
# On my Mac:
@jehrhardt
jehrhardt / KeyLengthDetector.java
Created March 15, 2013 06:23
Detect the allowed size of AES keys on the JVM. If the size is <= 256, it is limited. To fix it JCE unlimted stregth files are needed.
import javax.crypto.Cipher;
import java.security.NoSuchAlgorithmException;
public class KeyLengthDetector {
public static void main(String[] args) {
int allowedKeyLength = 0;
try {
allowedKeyLength = Cipher.getMaxAllowedKeyLength("AES");
} catch (NoSuchAlgorithmException e) {