Skip to content

Instantly share code, notes, and snippets.

@chetth
chetth / awk.sh
Created December 21, 2016 04:42
How to remove BOM from UTF-8
awk '{if(NR==1)sub(/^\xef\xbb\xbf/,"");print}' text-with-bom.txt
@chetth
chetth / syslog_count.go
Last active October 6, 2016 08:36
Print syslog request per sec.
package main
import (
"fmt"
"gopkg.in/mcuadros/go-syslog.v2"
"time"
)
func check(e error) {
if e != nil {
@chetth
chetth / Dockerfile
Last active September 28, 2016 03:53
A wrapper for SopCast media broadcaster
FROM debian:7
RUN dpkg --add-architecture i386
RUN apt-get update && apt-get install libstdc++5:i386 wget -y
RUN curl -o /docker-entrypoint.sh https://raw.githubusercontent.com/chetth/docker-sop2broadcast/master/docker-entrypoint.sh \
&& chmod +x /docker-entrypoint.sh
RUN mkdir /app
WORKDIR /app
RUN wget http://download.sopcast.com/download/sp-auth.tgz && apt-get remove -y wget
@chetth
chetth / locustfile.py
Created May 11, 2016 06:07
Example load testing tool file.
import random
from locust import HttpLocust, TaskSet, task
class WebsiteTasks(TaskSet):
@task(1)
def index(self):
with open("url_list", "r") as listdoc:
urls = listdoc.read().splitlines()
@chetth
chetth / sysctl.conf
Last active February 11, 2023 23:19
TCP stack tuning for high traffic server.
net.ipv4.ip_forward=0
net.ipv4.tcp_fin_timeout = 60
net.ipv4.tcp_retries1 = 3
net.ipv4.tcp_keepalive_probes = 9
net.ipv4.tcp_keepalive_time = 7200
net.ipv4.tcp_syn_retries = 5
kernel.sem = 250 32000 100 128
kernel.shmall = 209715200
kernel.shmmax = 214748364800