Skip to content

Instantly share code, notes, and snippets.

@s4l3h1
s4l3h1 / add_veth_pair.sh
Created May 13, 2017 11:05 — forked from thiagokronig/add_veth_pair.sh
Add veth pair to Docker container
# Fortemente baseado em https://github.com/jpetazzo/pipework
function add_veth_pair {
pid=$1 ; ipaddr=$2 ; container_ifname=$3
echo "Add interface $container_ifname with ip $ipaddr to container pid $pid"
local_ifname="v${container_ifname}l${pid}"
guest_ifname="v${container_ifname}g${pid}"
bridge='docker0'
mtu=$(ip link show $bridge | awk '{print $5}')
if ip link show "$local_ifname" >/dev/null 2>&1 ; then
ip link del "$local_ifname"
@s4l3h1
s4l3h1 / es-dump-index.py
Created July 24, 2017 13:12 — forked from spikeekips/es-dump-index.py
The simple script to dump the data from ElasticSearch for inserting by bulk API.
# -*- coding: utf-8 -*-
"""
################################################################################
Dump ElasticSearch index for inserting BULK
################################################################################
requires `rawes`.
for more details, run `-h` to show help message.
@s4l3h1
s4l3h1 / _service.md
Created August 9, 2017 15:35 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@s4l3h1
s4l3h1 / linode-ns-A-AAAA
Last active November 5, 2017 20:35
Linode DNS AAAA A network addresses
ns1.linode.com. 300 IN A 162.159.27.72
ns1.linode.com. 300 IN AAAA 2400:cb00:2049:1::a29f:1a63
ns2.linode.com. 300 IN A 162.159.24.39
ns2.linode.com. 300 IN AAAA 2400:cb00:2049:1::a29f:1827
ns3.linode.com. 300 IN A 162.159.25.129
ns3.linode.com. 300 IN AAAA 2400:cb00:2049:1::a29f:1981
ns4.linode.com. 300 IN A 162.159.26.99
ns4.linode.com. 300 IN AAAA 2400:cb00:2049:1::a29f:1b48
ns5.linode.com. 300 IN A 162.159.24.25
ns5.linode.com. 300 IN AAAA 2400:cb00:2049:1::a29f:1819
@s4l3h1
s4l3h1 / proxy.conf
Created December 16, 2017 23:30 — forked from sirsquidness/proxy.conf
How to have nginx proxy_pass follow upstream 302 redirects (eg, when you're running a steam cache and you're behind Cox's layer 7 interception stuff)
# This config came around after a friend had problems with a Steam cache on his
# Cox internet connection. Cox would intercept any requests to Steam content
# servers and return a 302 to Cox's servers. The cache would return the 302
# to the Steam client, and the Steam client would go directly to Cox, bypassing
# the cache.
# This config makes nginx follow the 302 itself, and caches the result of the
# redirect as if it was the response to the original request. So subsequent
# requests to the URL that returned a 302 will get the file instead of a 302.
@s4l3h1
s4l3h1 / tile_file.py
Created December 17, 2017 00:24
GeoServer tile with django
import os
from django.conf import settings
from django.http.request import HttpRequest
from django.http.response import HttpResponse, HttpResponseRedirectBase
def http_redirect(request=HttpRequest):
bbox = [float(i) for i in request.GET.get('bbox').split(',')[:4]]
layers = request.GET.get('layers').replace(':', '_')
@s4l3h1
s4l3h1 / nginx-tuning.md
Created December 18, 2017 15:52 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@s4l3h1
s4l3h1 / linkedin-unfollow.js
Created August 19, 2018 12:14 — forked from rahul286/linkedin-unfollow.js
LinkedIn Unfollow All
# goto https://www.linkedin.com/feed/following/
# in JS console run
var buttons = $("button"),
interval = setInterval(function(){
var btn = $('.is-following');
console.log("Clicking:", btn);
btn.click();
if (buttons.length === 0) {
clearInterval(interval);
def jobName = '(...)'
Jenkins.instance.getItemByFullName(jobName).builds.findAll { it.result == Result.FAILURE}.each { it.delete() }