Skip to content

Instantly share code, notes, and snippets.

View pierrebeaucamp's full-sized avatar

Pierre Beaucamp pierrebeaucamp

View GitHub Profile
@pozgo
pozgo / logger
Last active October 8, 2015 20:01
Journalctl to file for logstash-forwarder process
#!/bin/bash
is=`ps aux | grep "journalctl -f" | grep -v grep | awk '{print$2}'`
file=/var/log/system.log
msize="12400000" # Max file sieze set to 10MB
asize=`ls -l /var/log/system.log | awk '{print$5}'`
logstaship=`fleetctl list-machines -l | grep logsystem | awk '{print$2}'`
hostname=`hostname`
# Checking the size of log file
@behrtam
behrtam / tuple_add_bench.py
Created November 26, 2015 07:53
Let's find out what's the fastest way to add tuple. http://exercism.io/submissions/a508c287053f48cbb9e3754ebcf3346c
'''
Test performance of tuple adding on Macbook Air 2012:
unpacking : 1,598 min | 2,136 max | 1,787 avg (µs)
index : 2,622 min | 5,016 max | 3,402 avg (µs)
map add : 7,849 min | 10,670 max | 8,886 avg (µs)
map sum zip : 11,254 min | 16,354 max | 12,854 avg (µs)
'''
import timeit
def show_result(func, result):
@igrigorik
igrigorik / file.html
Created July 6, 2012 08:01
Example of early head flush on load time
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Hello</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
Hello World
</body>
@petedoyle
petedoyle / gist:4129668
Last active January 29, 2021 08:19
Notes: OpenWRT / Codel on TL-WDR4300

Overview

I'm tired of massive delay (500-1000 ms pings) while uploading large files. QoS helps some, but a significant portion remains due to bufferbloat (100-150ms). This leads to delay in VoIP calls and generally sluggish web browsing while uploading.

The new Codel algorithm in OpenWRT / Attitude Adjustment should help a lot. The results below show only ~5-6ms of added latency during uploads (i.e. 14ms vs 500+ms before!). Insane.

These instructions are for the TP-Link TL-WDR4300, because I got a good deal. If you have the money, buy a Netgear WNDR3800 and install CeroWRT, you'll probably see even better results.

Why the TP-Link TL-WDR4300

In short, its fully supported in OpenWRT Attitude Adjustment and works well for my needs:

  • Cheap
@andyshinn
andyshinn / README.md
Last active March 24, 2022 06:40
CoreOS on Digital Ocean using Terraform

Terraform, CoreOS, and Digital Ocean

Let's use Terraform to easily get a CoreOS cluster up on Digital Ocean. In this example we will get a 5 node CoreOS cluster up and running on the Digital Ocean 8GB size.

Install Terraform

Grab a copy of Terraform for your platform from http://www.terraform.io/downloads.html. Follow the instructions at http://www.terraform.io/intro/getting-started/install.html by getting Terraform in your PATH and testing that it works.

Digital Ocean API Key

@brendanzab
brendanzab / reactive_systems_bibliography.md
Last active October 10, 2022 06:36
A reading list that I'm collecting while building my Rust ES+CQRS framework: https://github.com/brendanzab/chronicle

Functional, Reactive, and Distributed Systems Bibliography

Books

@teffalump
teffalump / README.md
Last active January 4, 2023 21:17
OpenWRT adblock implementation

Others have recently developed packages for this same functionality, and done it better than anything I could do. Use the packages instead of this script:

Description

In its basic usage, this script will modify the router such that blocked addresses are null routed and unreachable. Since the address blocklist is full of advertising, malware, and tracking servers, this setup is generally a good thing. In addition, the router will update the blocklist weekly. However, the blocking is leaky, so do not expect everything to be blocked.

@IntergalacticApps
IntergalacticApps / make_windows10_great_again.bat
Last active December 28, 2023 08:16
Make Windows 10 Great Again - stop Windows 10 spying!
@echo off
setlocal EnableDelayedExpansion
ver | find "10." > nul
if errorlevel 1 (
echo Your Windows version is not Windows 10... yet. Brace yourself, Windows 10 is coming^^!
pause
exit
)
@jessfraz
jessfraz / boxstarter.ps1
Last active April 11, 2024 16:02
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Jess Frazelle <jess@linux.com>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
@plentz
plentz / nginx.conf
Last active April 24, 2024 11:15
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048