Skip to content

Instantly share code, notes, and snippets.

View dongguangming's full-sized avatar

dongguangming dongguangming

View GitHub Profile
package com.yourproject.datastructures;
import java.io.*;
import java.util.*;
import java.util.function.Consumer;
/**
* Disk-backed array list
* @param <E> element type
*/
@gmr
gmr / rabbitmq-autocluster_k8s_persistent.bash
Created January 10, 2018 20:24 — forked from pmint93/rabbitmq-autocluster_k8s_persistent.bash
Deploy rabbitmq-autocluster on k8s with persistent storage (EBS)
#!/bin/bash
set -eo pipefail
export KUBE_NAMESPACE=test
export REPLICA_COUNT=3
cat <<EOF | kubectl apply -f -
apiVersion: apps/v1beta1
kind: StatefulSet
@patrickhuber
patrickhuber / install-kubernetes-1-6-on-centos-7-3.md
Last active July 18, 2021 12:24
install kubernetes 1.6 on centos 7.3

install kubernetes 1.6 on centos 7.3

Install kubelet, kubeadm, docker, kubectl and kubernetes-cni

1. Install Yum Repo

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=http://yum.kubernetes.io/repos/kubernetes-el7-x86_64
@simonw
simonw / recover_source_code.md
Last active September 28, 2024 08:10
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@sauercrowd
sauercrowd / install-master.sh
Last active July 4, 2017 04:05
setup-kubernetes
#!/bin/bash
HOST_IP=`ip addr show ens3 | grep -Eo 'inet ([0-9]*\.)*[0-9]*' | grep -Eo '([0-9]|\.)*'`
set -e
set -x
echo "[req]" > openssl.cnf
echo "req_extensions = v3_req" >> openssl.cnf
echo "distinguished_name = req_distinguished_name" >> openssl.cnf
@marlonbernardes
marlonbernardes / run-jar-as-a-service.md
Last active October 18, 2021 16:12
How to make a jar file run on startup
  1. Create the start and stop scripts of your application.
  • Example:

myapp-start.sh

#!/bin/bash
cd /home/ubuntu/myapp/
java -jar myapp.jar --server.port=8888 &
@JaviLorbada
JaviLorbada / FRP iOS Learning resources.md
Last active April 20, 2025 21:15
The best FRP iOS resources.

Videos

@ericelliott
ericelliott / essential-javascript-links.md
Last active March 22, 2025 17:28
Essential JavaScript Links
@ppo
ppo / regex-ecma-262-5_1.txt
Last active September 10, 2024 15:36
Validation Regex ECMA-262 5.1 (date and/or time with optional timezone)
Format: YYYY-MM-DDTHH:mm:ss.sssZ
Date: ^\d{4}(-\d{2}){0,2}$
Time: ^\d{2}(:\d{2}(:\d{2}(\.\d+)?)?)?$
Time with optional timezone: ^\d{2}(:\d{2}(:\d{2}(\.\d+)?)?)?(Z|[\+|-]\d{2}:\d{2})?$
Date and/or time with optional timezone:
(^\d{4}(-\d{2}){0,2})?((^|T)\d{2}(:\d{2}(:\d{2}(\.\d+)?)?)?(Z|[\+|-]\d{2}:\d{2})?)?$
@philmadden83
philmadden83 / gist:2726a334ce52e7181a5d
Last active March 25, 2021 17:48
Unit test with automatic singleton mocking and wiring
package com.vivid.publik;
import com.ibatis.dao.client.DaoManager;
import com.vivid.estore.persistence.DaoConfig;
import com.vivid.estore.persistence.iface.*;
import com.vivid.estore.persistence.sqlmapdao.*;
import com.vivid.estore.util.TestFixtureFactory;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;