Skip to content

Instantly share code, notes, and snippets.

@yaowenqiang
yaowenqiang / fiddler_with_python.md
Created April 13, 2022 09:44 — forked from Firenza/fiddler_with_python.md
Get fiddler working with python requests module

Get fiddlers base64 encoded root certificate

  1. Install fiddler winget install -e --id Telerik.Fiddler
  2. Open fiddler and go to Tools -> Options -> HTTPS
  3. Enable Decrypt HTTPS traffic
  4. Click the Actions button and select Export root certificate to desktop
  5. Right click the FiddlerRoot.cer file on the desktop and click Open with -> Crypto Shell Extensions
  6. In the Certificate window that opens up go to Details -> Copy to File
  7. Click Next then select Base-64 encoded X.509 (.CER) then specify the file name (E.G. FiddlerRootBase64.cer)
  8. Click Next to create the new file
@yaowenqiang
yaowenqiang / Dumper.py
Created August 31, 2021 13:54 — forked from passos/Dumper.py
A perl Data.Dumper clone for Python
"""
A perl Data.Dumper clone for Python
Author: simon@log4think.com
2011-07-08
Copyright 2011 Jinyu LIU
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Fibers

Fibers are an abstraction over sequential computation, similar to threads but at a higher level. There are two ways to think about this model: by example, and abstractly from first principles. We'll start with the example.

(credit here is very much due to Fabio Labella, who's incredible Scala World talk describes these ideas far better than I can)

Callback Sequentialization

Consider the following three functions

Thread Pools

Thread pools on the JVM should usually be divided into the following three categories:

  1. CPU-bound
  2. Blocking IO
  3. Non-blocking IO polling

Each of these categories has a different optimal configuration and usage pattern.

@yaowenqiang
yaowenqiang / Docker connect to remote server.md
Created May 31, 2021 03:39 — forked from kekru/Docker connect to remote server.md
Connect to another host with your docker client, without modifying your local Docker installation

Run commands on remote Docker host

This is how to connect to another host with your docker client, without modifying your local Docker installation or when you don't have a local Docker installation.

Enable Docker Remote API

First be sure to enable the Docker Remote API on the remote host.

This can easily be done with a container.
For HTTP connection use jarkt/docker-remote-api.

Tmux is a "terminal multiplexer", it enables a number of terminals to be accessed and controlled from a single terminal.
If you use Debian/Ubuntu, you can just run apt-get install tmux, and voila.
Since the title was about centos 7, then do the following step to install tmux.
(1). tmux has a library dependency on libevent which, of course, isn’t installed by default.
$ wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
$ tar xzvf libevent-2.0.21-stable.tar.gz
$ cd libevent-2.0.21-stable
$ ./configure && make
@yaowenqiang
yaowenqiang / install-tmux.sh
Created October 16, 2020 09:46 — forked from muralisc/install-tmux.sh
Install tmux 3.0a on Amazon Linux 2 / rhel /centos
# Install tmux 3.0a on Centos
# install deps
sudo yum install -y gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
curl -LOk https://github.com/libevent/libevent/releases/download/release-2.1.11-stable/libevent-2.1.11-stable.tar.gz
tar -xf libevent-2.1.11-stable.tar.gz
cd libevent-2.1.11-stable
./configure --prefix=/usr/local
@yaowenqiang
yaowenqiang / kubectl-shortcuts.sh
Created August 1, 2020 14:02 — forked from tamas-molnar/kubectl-shortcuts.sh
aliases and shortcuts for kubectl
alias kc='kubectl'
alias kclf='kubectl logs --tail=200 -f'
alias kcgs='kubectl get service -o wide'
alias kcgd='kubectl get deployment -o wide'
alias kcgp='kubectl get pod -o wide'
alias kcgn='kubectl get node -o wide'
alias kcdp='kubectl describe pod'
alias kcds='kubectl describe service'
alias kcdd='kubectl describe deployment'
alias kcdf='kubectl delete -f'
@yaowenqiang
yaowenqiang / install-tmux.sh
Created July 1, 2020 05:41 — forked from pokev25/install-tmux.sh
Install tmux 2.8 on centos 7
# Install tmux 2.8 on Centos
# install deps
yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
curl -LOk https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
tar -xf libevent-2.1.8-stable.tar.gz
cd libevent-2.1.8-stable
./configure --prefix=/usr/local
@yaowenqiang
yaowenqiang / session-handler-life-cycle.md
Created April 27, 2020 10:21 — forked from franksacco/session-handler-life-cycle.md
A complete overview of PHP session handler life cycle

A complete overview of PHP session handler life cycle

The purpose of this document is to provide a complete overview of the PHP session handler life cycle updated to version 7.0 or above. In particular, I want to emphasize what methods and in what order are called when the native PHP functions are used for session management.
I created this document because the information on the web and the official documentation are very superficial on this topic, in particular on what concerns the implementation of a safe and stable session handler.