Skip to content

Instantly share code, notes, and snippets.

apiVersion: v1
kind: ConfigMap
metadata:
name: redis-config
data:
redis.conf: |-
bind 0.0.0.0
port 6379
protected-mode no
tcp-backlog 511
package main
import (
"fmt"
"os"
"strconv"
"syscall"
"unsafe"
)
use std::io::{Read, Write, Result as IoResult};
use std::net::{UdpSocket, TcpStream};
const HOST: &str = "127.0.0.1";
const PORT: u16 = 5354;
const UPSTREAM: &str = "114.114.114.114";
const UPSTREAM_PORT: u16 = 53;
fn be_bytes_to_u16(b: &[u8;2]) -> u16 {
return ((b[0] as u16) << 8) | (b[1] as u16);
#!/usr/bin/env bash
: '
Simulate `kubectl rollout restart` commnad in 1.15.
'
set -o pipefail
set -o nounset
set -o errexit
usage() {
package main
import (
"context"
"flag"
"fmt"
"net"
"time"
)
@monsterxx03
monsterxx03 / celery_test.py
Last active February 11, 2019 04:09
test for celery memory leak
import resource
import gc
from celery import Celery
app = Celery()
app.conf.update(BROKER_URL='redis://localhost:6379/1')
@app.task
def dummy():
@monsterxx03
monsterxx03 / test.py
Created December 29, 2018 07:10
nagle's algorithm test
import socket
import time
host = '127.0.0.1'
port = 80
TOTAL_TIME = 0
count = 10

Keybase proof

I hereby claim:

  • I am monsterxx03 on github.
  • I am monsterxx03 (https://keybase.io/monsterxx03) on keybase.
  • I have a public key ASCvzuVyvGtUBllQW-u5m7Tz47GYN9OZpBPnvFzDZWs5ygo

To claim this, I am signing this object:

@monsterxx03
monsterxx03 / gist:3081d45ded8ac7649427
Created July 1, 2014 03:22
get value from memcache based on keystone's token id
# need install dogpile.cache
from hashlib import sha1
token_id = "b7e3119430214967ae34695bab783b08"
key = sha1("token-" + token_id).hexdigest()
c = memcache.Client([“127.0.0.1:11211”])
value = c.get(memcache_key)
print value
@monsterxx03
monsterxx03 / cprofile
Created March 19, 2014 09:22
cprofile
def profile(result_file_name):
def wrapper(fn):
def inner_wrapper(*args, **kwargs):
import cProfile, pstats
pr = cProfile.Profile()
pr.enable()
value = fn(*args, **kwargs)