Skip to content

Instantly share code, notes, and snippets.

@liaoyw
liaoyw / install-pyenv-centos-7
Created December 30, 2024 12:48 — forked from jess-sol/install-pyenv-centos-7
Install pyenv on CentOS 7 for a specific user with dependencies to manage installed versions of Python
sudo yum install \
git gcc zlib-devel bzip2-devel readline-devel \
sqlite-devel openssl-devel libffi-devel
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
cat <<'EOF' >> ~/.bash_profile
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv 1>/dev/null 2>&1; then
@liaoyw
liaoyw / ReadingHelmResources.md
Created September 12, 2024 13:01 — forked from DzeryCZ/ReadingHelmResources.md
Decoding Helm3 resources in secrets

Helm 3 is storing description of it's releases in secrets. You can simply find them via

$ kubectl get secrets
NAME                                                TYPE                                  DATA   AGE
sh.helm.release.v1.wordpress.v1                     helm.sh/release.v1                    1      1h

If you want to get more info about the secret, you can try to describe the secret

$ kubectl describe secret sh.helm.release.v1.wordpress.v1
@liaoyw
liaoyw / 01.bash_shortcuts_v2.md
Created February 6, 2023 16:19 — forked from tuxfight3r/01.bash_shortcuts_v2.md
Bash keyboard shortcuts

Bash Shortcuts

visual cheetsheet

Moving

command description
ctrl + a Goto BEGINNING of command line
@liaoyw
liaoyw / aes_cbc_pkcs5.go
Created February 20, 2021 08:06 — forked from hothero/aes_cbc_pkcs5.go
AES/CBC/PKCS5Padding implementation by Golang (can work with JAVA, C#, etc.)
package main
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"encoding/base64"
"fmt"
)
@liaoyw
liaoyw / BTree.cpp
Created April 28, 2020 06:36 — forked from pervognsen/BTree.cpp
A B+-tree implementation with find, insert and delete in 176 lines of code.
enum { BMAX = 32, BMIN = BMAX / 2, BHEIGHT = 6 };
struct BNode {
uint32_t length;
Key keys[BMAX];
union {
BNode *children[BMAX];
Value values[BMAX];
};
};
@liaoyw
liaoyw / tcp_flags.txt
Created November 24, 2019 12:46 — forked from tuxfight3r/tcp_flags.txt
tcpdump - reading tcp flags
##TCP FLAGS##
Unskilled Attackers Pester Real Security Folks
==============================================
TCPDUMP FLAGS
Unskilled = URG = (Not Displayed in Flag Field, Displayed elsewhere)
Attackers = ACK = (Not Displayed in Flag Field, Displayed elsewhere)
Pester = PSH = [P] (Push Data)
Real = RST = [R] (Reset Connection)
Security = SYN = [S] (Start Connection)
#!/bin/bash
function gitclone() {
cd ~/workspace
path=$1
# remove http:// or https:// at the begining
path=${path#http://}
path=${path#https://}
@liaoyw
liaoyw / MonBuffers.java
Created August 10, 2018 07:38 — forked from t3rmin4t0r/MonBuffers.java
Monitoring direct memory in the JVM (from https://blogs.oracle.com/alanb/entry/monitoring_direct_buffers, adapted for JDK8)
import java.io.File;
import java.util.*;
import java.lang.management.BufferPoolMXBean;
import java.lang.management.ManagementFactory;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import javax.management.remote.*;
import com.sun.tools.attach.VirtualMachine; // Attach API
package main
import "log"
import "flag"
import "net/http"
import "fmt"
var dir = flag.String("d", ".", "file directory")
var port = flag.Int("p", 8088, "server port")
@liaoyw
liaoyw / cfs_quota.go
Last active September 17, 2017 04:42
package main
import (
"flag"
"time"
"sync/atomic"
"hash/adler32"
"fmt"
"os"
"runtime"