Skip to content

Instantly share code, notes, and snippets.

@mskutta
mskutta / EdgeRouter_IPv6_Commands_for_Comcast.txt
Last active December 6, 2023 02:11
EdgeRouter IPv6 Commands for Comcast
configure
# Configure Firewall
set firewall ipv6-name IPV6WAN_IN description 'IPV6WAN to internal'
set firewall ipv6-name IPV6WAN_IN default-action drop
set firewall ipv6-name IPV6WAN_IN rule 10 action accept
set firewall ipv6-name IPV6WAN_IN rule 10 state established enable
set firewall ipv6-name IPV6WAN_IN rule 10 state related enable
set firewall ipv6-name IPV6WAN_IN rule 10 log disable
@baltpeter
baltpeter / config
Created July 10, 2015 21:06
Proxmox Reverse Proxy with Nginx
server {
listen 443;
server_name pve.mydomain.com;
ssl on;
ssl_certificate /etc/nginx/ssl/ssl.crt;
ssl_certificate_key /etc/nginx/ssl/ssl.key;
proxy_redirect off;
location / {
@sameersbn
sameersbn / gitlab.conf
Created February 6, 2015 09:53
Nginx reverse proxy configuration for GitLab
upstream gitlab {
server 172.17.42.1:10080 fail_timeout=0;
}
# let gitlab deal with the redirection
server {
listen 80;
server_name git.example.com;
server_tokens off;
root /dev/null;
@h4cc
h4cc / array_filter_key.php
Created October 6, 2014 12:29
Filtering a PHP array by key instead of value.
<?php
/**
* Filtering a array by its keys using a callback.
*
* @param $array array The array to filter
* @param $callback Callback The filter callback, that will get the key as first argument.
*
* @return array The remaining key => value combinations from $array.
*/
@tiagoad
tiagoad / rtorrent
Created August 8, 2014 14:39
rtorrent init file
#!/bin/bash
### BEGIN INIT INFO
# Provides: rtorrent
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop rtorrent daemon
### END INIT INFO
@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
@marianposaceanu
marianposaceanu / latency.md
Created May 31, 2012 10:18 — forked from jboner/latency.txt
Latency numbers every programmer should know

CPU

  • L1 cache reference 0.5 ns
  • Branch mispredict 5 ns (on a bad CPU architecture you're pretty much screwed)
  • L2 cache reference 7 ns
  • Mutex lock/unlock 25 ns
  • Main memory reference 100 ns
  • Compress 1K bytes with Zippy 3,000 ns
  • Send 2K bytes over 1 Gbps network 20,000 ns
  • Read 1 MB sequentially from memory 250,000 ns
@jboner
jboner / latency.txt
Last active May 4, 2024 18:45
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
<?php
class base58
{
static public $alphabet = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ";
public static function encode($int) {
$base58_string = "";
$base = strlen(self::$alphabet);
while($int >= $base) {
@pokeb
pokeb / HTTP Cookie header parser
Created September 13, 2008 11:23
Quick and dirty HTTP cookie header parser in PHP