Skip to content

Instantly share code, notes, and snippets.

View bchatelard's full-sized avatar

Bastien Chatelard bchatelard

View GitHub Profile
@mcastelino
mcastelino / tc mirroring.md
Last active December 11, 2023 02:16
Using tc redirect to connect a virtual machine to a container network

Connecting a veth device to tap

  • veth device from CNI/CNM plugin: eth0
  • tap device that connects to the VM: tap0

Redirecting traffic between the two devices

tc qdisc add dev eth0 ingress
tc filter add dev eth0 parent ffff: protocol all u32 match u8 0 0 action mirred egress redirect dev tap0
@moul
moul / scaleway-ipxe.expect
Last active March 25, 2016 20:05
drop ipxe shell on scaleway
#!/usr/bin/expect
# Usage: ipxe.expect "SCW_RUN_ARGS" ["IPXE LINE" ["IPXE LINE" [...]]]
#
# Examples:
# ipxe.expect \
# "--commercial-type=VC1 50G" \
# "chain --autofree http://boot.netboot.xyz/menu.ipxe"
#
# ipxe.expect \
# "50G" \
@nachokb
nachokb / centos-scaleway.md
Last active March 16, 2017 07:11
Instruction for running CentOS 6.7 on Scaleway's C2
  1. create a scaleway instance, let's call it centos-builder
  2. Ubuntu Trusty on a C2S is ok
  3. make sure to add an additional 50gb volume Screenshot_from_2016-03-11_02-19-22
  4. upload centos-root.fsa to centos-builder
  5. install FSArchiver
  6. apt-get install fsarchiver
  7. extract it on /dev/nbd1
  8. fsarchiver -v restfs centos-root.fsa id=0,dest=/dev/nbd1
  9. shut the machine down from Scaleway's web UI
from scapy.all import *
def arp_display(pkt):
if pkt[ARP].op == 1: #who-has (request)
if pkt[ARP].psrc == '0.0.0.0': # ARP Probe
if pkt[ARP].hwsrc == '74:75:48:5f:99:30': # Huggies
print "Pushed Huggies"
elif pkt[ARP].hwsrc == '10:ae:60:00:4d:f3': # Elements
print "Pushed Elements"
else:
print "ARP Probe from unknown device: " + pkt[ARP].hwsrc
@chanks
chanks / gist:7585810
Last active September 17, 2024 11:55
Turning PostgreSQL into a queue serving 10,000 jobs per second

Turning PostgreSQL into a queue serving 10,000 jobs per second

RDBMS-based job queues have been criticized recently for being unable to handle heavy loads. And they deserve it, to some extent, because the queries used to safely lock a job have been pretty hairy. SELECT FOR UPDATE followed by an UPDATE works fine at first, but then you add more workers, and each is trying to SELECT FOR UPDATE the same row (and maybe throwing NOWAIT in there, then catching the errors and retrying), and things slow down.

On top of that, they have to actually update the row to mark it as locked, so the rest of your workers are sitting there waiting while one of them propagates its lock to disk (and the disks of however many servers you're replicating to). QueueClassic got some mileage out of the novel idea of randomly picking a row near the front of the queue to lock, but I can't still seem to get more than an an extra few hundred jobs per second out of it under heavy load.

So, many developers have started going straight t

@melekes
melekes / README.md
Created August 30, 2013 08:51
Yet another Google Calendar Dashing widget

Yet another Google Calendar Dashing widget

Yet another Google Calendar Dashing widget

Description

Dashing widget to display first two coming-up Google Calendar events.

Basically, you do not need more than two events on your dashboard, but it can be easily extended to the neighboring cells and show, say, 4 events instead of 2.

@adamloving
adamloving / temporary-email-address-domains
Last active September 9, 2024 15:46
A list of domains for disposable and temporary email addresses. Useful for filtering your email list to increase open rates (sending email to these domains likely will not be opened).
0-mail.com
0815.ru
0clickemail.com
0wnd.net
0wnd.org
10minutemail.com
20minutemail.com
2prong.com
30minutemail.com
3d-painting.com
@nsanta
nsanta / three.coffee
Created November 2, 2012 00:10
angular timeline blog post gists three
#app is the variable that contains the module “AwesomeApp”
app.controller ‘SessionCtrl’, ($scope, $location, Session) →
$scope.login =
Session.save $scope.session , (response) →
$location.path/dashboard”
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active September 22, 2024 08:03
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@fabiant7t
fabiant7t / s3_multipart_upload.py
Created April 17, 2011 14:54
Parallel S3 multipart upload with retries
import logging
import math
import mimetypes
from multiprocessing import Pool
import os
from boto.s3.connection import S3Connection
from filechunkio import FileChunkIO