Skip to content

Instantly share code, notes, and snippets.

View wklken's full-sized avatar
😄
Coding

wklken wklken

😄
Coding
View GitHub Profile
@non-static
non-static / status_code_analysis.lua
Last active November 4, 2023 07:56
Lua script for wrk2 to count response code and a particular header
wrk.method = "POST"
local f = io.open("data.json", "r")
wrk.body = f:read("*all")
wrk.headers["Content-Type"] = "application/json"
wrk.headers["Host"] = "foo.bar.net"
local counter = 1
local threads = {}
package main
import (
"fmt"
"log"
"os"
"sync"
"time"
)
@treyhunner
treyhunner / choice_enum.py
Created April 9, 2018 23:49
Enum for use with Django ChoiceField
from enum import Enum, EnumMeta
class ChoiceEnumMeta(EnumMeta):
def __iter__(self):
return ((tag, tag.value) for tag in super().__iter__())
class ChoiceEnum(Enum, metaclass=ChoiceEnumMeta):
"""
@sumanmukherjee03
sumanmukherjee03 / cipher_encryption_decryption.go
Last active November 15, 2024 13:47
AES GCM example in python and go
package main
import (
"crypto/aes"
"crypto/cipher"
"fmt"
"reflect"
"strconv"
"time"
)
@zhiguangwang
zhiguangwang / README.md
Last active November 8, 2024 18:43
Installing and running shadowsocks on Ubuntu Server

Installing and running shadowsocks on Ubuntu Server

16.10 yakkety and above

  1. Install the the shadowsocks-libev package from apt repository.

     sudo apt update
     sudo apt install shadowsocks-libev
    
  2. Save ss.json as /etc/shadowsocks-libev/config.json.

@magnetikonline
magnetikonline / README.md
Last active October 31, 2024 17:00
Bash string manipulation cheatsheet.

Bash string manipulation cheatsheet

Assignment
Assign value to variable if variable is not already set, value is returned.

Combine with a : no-op to discard/ignore return value.
${variable="value"}
: ${variable="value"}
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@kelvinn
kelvinn / cmd.sh
Created July 24, 2014 02:55
Example of using Apache Bench (ab) to POST JSON to an API
# post_loc.txt contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/
diff -cr Python-2.7.6/Include/opcode.h Python-2.7.6-patched/Include/opcode.h
*** Python-2.7.6/Include/opcode.h 2013-11-10 08:36:39.000000000 +0100
--- Python-2.7.6-patched/Include/opcode.h 2014-05-16 16:14:42.885966107 +0200
***************
*** 149,154 ****
--- 149,155 ----
#define SET_ADD 146
#define MAP_ADD 147
+ #define LOAD_FAST_ZERO_LOAD_CONST 148
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote