Skip to content

Instantly share code, notes, and snippets.

View tianchaijz's full-sized avatar
🏠
Working from home

tianchaijz tianchaijz

🏠
Working from home
View GitHub Profile
@fschiettecatte
fschiettecatte / HighTrafficServerSettings.md
Last active January 22, 2024 21:31
High Traffic Server Settings on RHEL / AlmaLinux / Rocky / EuroLinux / CentOS 8

High Traffic Server Settings on RHEL / AlmaLinux / Rocky / EuroLinux / CentOS 8

I recently did some work to optimize the network configuration of an AlmaLinux 8 based web server that receives a lot of traffic.

Of course these settings also apply to RHEL / Rocky / EuroLinux / CentOS 8 (hereafter referred to as Linux 8.) I think these should also work on RHEL / AlmaLinux / Rocky / EuroLinux 9 as well but I have not yet tested them.

There is a lot of information on the web for this and it distills down to a minimum recommended configuration, and a recommended configuration.

The minimum recommended configuration should be sufficient for servers with less than 10Gb, and the recommended configuration should be sufficient for servers with 10Gb or more.

package main
import (
"fmt"
"golang.org/x/net/http2/hpack"
)
func main() {
fmt.Println("nginx", "→", Encode("MYWS"))
fmt.Println("nginx", "→", Encode("nginx"))
@quasilyte
quasilyte / channels.go
Created November 8, 2018 09:44
Channel vs mutex vs atomic for synchronized counter
package benchmark
import (
"context"
"runtime"
"sync"
"sync/atomic"
"testing"
"time"
)
@arnabdas
arnabdas / haskell-install.sh
Created September 25, 2018 16:11
Install Haskell on Ubuntu 18.04
#!/bin/bash
add-apt-repository -y ppa:hvr/ghc
apt-get install -y cabal-install-2.4
apt install ghc-8.6
curl -sSL https://get.haskellstack.org/ | sh
# to install intero, either install
@yudai
yudai / README.md
Created November 29, 2017 01:04
tmux + mosh OSC 52 clipboard paste hack

Problem

Now tmux, mosh and iTerm2 support the OSC 52 sequence that enables clipboard sharing. However, there is a trap that prevents them from working together.

Mosh accepts OSC 52 sequences with the c; option. However, tmux doesn't send that option when it emits OSC 52 sequences, which means you cannot use tmux and mosh together with the default configuration.

Workaround

You can override the OSC 52 sequence generated by tmux by adding the following line to your tmux.conf.

@tombigel
tombigel / README.md
Last active May 6, 2024 03:23 — forked from a2ikm/limit.maxfiles.plist
How to Change Open Files Limit on OS X and macOS Sierra (10.8 - 10.12)

How to Change Open Files Limit on OS X and macOS

This text is the section about OS X Yosemite (which also works for macOS Sierra) from https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/#mac-os-x

The last time i visited this link it was dead (403), so I cloned it here from the latest snapshot in Archive.org's Wayback Machine https://web.archive.org/web/20170523131633/https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/

Mac OS X

To check the current limits on your Mac OS X system, run:

@itamarhaber
itamarhaber / Makefile
Last active August 8, 2023 15:47
Module development environment walkthrough
SHOBJ_CFLAGS ?= -fno-common -g -ggdb
SHOBJ_LDFLAGS ?= -shared -Bsymbolic
CFLAGS = -Wall -g -fPIC -lc -lm -Og -std=gnu99
CC=gcc
all: example.so
example.so: example.o
$(LD) -o $@ example.o $(SHOBJ_LDFLAGS) $(LIBS) -lc
@lilydjwg
lilydjwg / mynetns_run
Created May 13, 2016 14:27
mynetns_run: Run a program in a seperate network namespace
#!/bin/bash -e
NETNS_FILE=/var/run/netns/mynet
MNTNS_FILE=/var/run/ns/mynet_mnt
if [[ ! -f $NETNS_FILE ]]; then
ip netns add mynet
ip link add mynet0 type veth peer name mynet1
ip link set mynet0 up
@tianchaijz
tianchaijz / ztest.vim
Last active August 16, 2018 01:55
ztest vim syntax file
" Vim syntax file
" Language: ztest
" Maintainer: Jinzheng Zhang <tianchaijz@gmail.com>
if exists('b:current_syntax') && b:current_syntax == 'ztest'
finish
endif
@tianchaijz
tianchaijz / github-api.py
Last active August 8, 2022 04:17
A python script to clone a specified github user's repos, gists.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import time
import json
import logging
import requests