Skip to content

Instantly share code, notes, and snippets.

View pmint93's full-sized avatar
Working from anywhere

Thanh Pham Minh pmint93

Working from anywhere
View GitHub Profile
@pmint93
pmint93 / tcpdump.md
Created July 31, 2023 14:23 — forked from dacr/tcpdump.md
tcpdump cheat sheet / published by https://github.com/dacr/code-examples-manager #dc012b03-0968-4a22-adec-c9483bdab8c6/9af294dd1dbac76b4ac789383de5794632247810
@pmint93
pmint93 / elasticsearch-poststart-settings.yaml
Last active May 17, 2023 07:55
Elasticsearch post-start script to automatic update indicies settings (example with docker-compose)
version: "3.3"
services:
elasticsearch:
container_name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.3.1
restart: unless-stopped
ports:
- "9200:9200"
environment:
@pmint93
pmint93 / self-signed-certificate-with-custom-ca.md
Created April 11, 2019 09:15 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@pmint93
pmint93 / rabbitmq-autocluster_k8s_persistent.bash
Last active March 23, 2019 03:14
Deploy rabbitmq-autocluster on k8s with persistent storage
#!/bin/bash
set -eo pipefail
export KUBE_NAMESPACE=test
export REPLICA_COUNT=3
cat <<EOF | kubectl apply -f -
apiVersion: apps/v1beta1
kind: StatefulSet
@pmint93
pmint93 / encrypt_openssl.md
Created January 5, 2018 04:28 — forked from dreikanter/encrypt_openssl.md
File encryption using OpenSSL

Symmetic encryption

For symmetic encryption, you can use the following:

To encrypt:

openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt

To decrypt:

Make IP phone call

METHOD: SOAP
URL: http://remote_host/TPCDialOut2/services/CallCenter?wsdl
PARAMS:
  agent_code: <Staff email>
@pmint93
pmint93 / fontbox.vn.downloader.temp.js
Created September 19, 2015 02:56
Fontbox.vn Temporary Downloader fix
//Buy Form
jQuery.fn.fontbox_buy_form = function(variables){
var z_this_form = jQuery(this);
var a_check_all = jQuery('#buy_check_all');
var b_check_box_child_class = '.buy-check-box';
var c_check_box_class = '.check-box';
var d_total_price = 0;
var e_total_price_obj = jQuery('#buy_total_price');
var f_total_check_box_child = jQuery(b_check_box_child_class).size();
var g_download_iframe = jQuery('#buy_download_iframe');
@pmint93
pmint93 / rmq_queue_cleaner.js
Last active August 29, 2015 14:24
Delete rabbitMQ queues by name matching
// Author: pmint93
function run(virtual_host, mask, auth){
var trs = $('.updatable table.list tbody tr');
var queues = trs.each(function(i, v){
var name = $(v).find('td').eq(1).text();
console.log(name);
if(name.match(mask)){
$.ajax({
method: 'GET',
def run
n = 1_000
id = User.first.id
display_name = User.only(:display_name).find(id).display_name
Benchmark.bm(50) do |x|
x.report('User.find(id).display_name') do
n.times{ User.find(id).display_name }
end
# Author: pmint93
# Exercise: https://www.facebook.com/groups/718037468264021/permalink/765003373567430/
class Greeter
def self.hello(file = '')
yield if defined? yield
eval open(file).read if File.exist? file
end
end