Skip to content

Instantly share code, notes, and snippets.

View alexalouit's full-sized avatar

Alexandre Alouit alexalouit

View GitHub Profile
@AnimeshShaw
AnimeshShaw / RemoveWatermark.py
Last active August 29, 2015 14:08
Removes the it-ebooks.info link and text markup from
#/bin/env/python
#Author : Psycho_Coder
#Date : 7/11/2014
import os
import sys
import binascii
hex_link_pat = "".join("0A 2F 42 6F 72 64 65 72 20 5B 20 30 20 30 20 30 20 5D "
"0A 2F 41 20 3C 3C 0A 2F 54 79 70 65 20 2F 41 63 74 69 "
@dterei
dterei / sasl_test.c
Created November 5, 2014 20:03
Libmemcached SASL authentication test
/*
* Test that libmemcached is built with SASL support.
*/
#include <stdio.h>
#include <libmemcached/memcached.h>
const char* key = "abc";
const char* value = "value";
// test basic get/set operation works.
@4BitBen
4BitBen / iostat-extended.conf
Created June 12, 2014 22:50
logstash-iostat
# Processes iostat output
# >iostat -d -m -x sda sdb 1 | bin/logstash -f iostat.conf
#
# Sample Output:
#
# Device: rrqm/s wrqm/s r/s w/s rMB/s wMB/s avgrq-sz avgqu-sz await svctm %util
# sda 3.36 174.28 9.64 183.71 65.17 1431.99 15.49 0.61 3.16 0.09 1.65
# sdb 0.00 0.00 742.87 4110.46 5830.48 16441.82 9.18 4.90 0.98 0.11 55.45
@nternetinspired
nternetinspired / gist:7482445
Last active February 24, 2022 17:20
Load Disqus comments only on demand if you give a shit about page weight and your visitors. Even with no comments, i.e. an empty comment form, calling Disqus will load an extra 226Kb. If your page has comments this can be far higher. This Gist accompanies my blog post: http://internet-inspired.com/wrote/load-disqus-on-demand/
// Requires jQuery of course.
$(document).ready(function() {
$('.show-comments').on('click', function(){
var disqus_shortname = 'YOUR-DISQUS-USERNAME'; // Replace this value with *your* username.
// ajax request to load the disqus javascript
$.ajax({
type: "GET",
url: "http://" + disqus_shortname + ".disqus.com/embed.js",
dataType: "script",
@brablc
brablc / postfix_grok_pattern
Last active September 27, 2020 20:10
Logstash example configuration for parsing Postfix mail log files
# Postfix stuff based on https://gist.github.com/jbrownsc/4694374:
QUEUEID (?:[A-F0-9]+|NOQUEUE)
EMAILADDRESSPART [a-zA-Z0-9_.+-=:]+
EMAILADDRESS %{EMAILADDRESSPART:local}@%{EMAILADDRESSPART:remote}
RELAY (?:%{HOSTNAME:relayhost}(?:\[%{IP:relayip}\](?::[0-9]+(.[0-9]+)?)?)?)
POSREAL [0-9]+(.[0-9]+)?
DELAYS (%{POSREAL}[/]*)+
DSN %{NONNEGINT}.%{NONNEGINT}.%{NONNEGINT}
STATUS sent|deferred|bounced|expired
@wolever
wolever / MIT-LICENSE.txt
Last active June 1, 2022 05:42 — forked from niw/MIT-LICENSE.txt
Put a mac's AirPort in HostAP mode. Updated to work with OS X 10.8.
Copyright (C) 2012 Yoshimasa Niwa
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@faisalman
faisalman / baseConverter.js
Last active January 11, 2023 14:43
Convert From/To Binary/Decimal/Hexadecimal in JavaScript
/**
* Convert From/To Binary/Decimal/Hexadecimal in JavaScript
* https://gist.github.com/faisalman
*
* Copyright 2012-2015, Faisalman <fyzlman@gmail.com>
* Licensed under The MIT License
* http://www.opensource.org/licenses/mit-license
*/
(function(){
@joemiller
joemiller / netpps.sh
Last active January 12, 2024 15:39
shell: quick linux scripts for showing network bandwidth or packets-per-second
#!/bin/bash
if [ -z "$1" ]; then
echo
echo usage: $0 network-interface
echo
echo e.g. $0 eth0
echo
echo shows packets-per-second
@bitboxer
bitboxer / makeImage.sh
Created May 8, 2011 18:11
create a sparsebundle for mac os backups
#!/bin/bash
# A bash script to create a time machine disk image suitable for
# backups with OS X 10.6 (Snow Leopard)
# This script probably only works for me, so try it at your own peril!
# Use, distribute, and modify as you see fit but leave this header intact.
# (R) sunkid - September 5, 2009
#
# This will create a time machine ready disk image named with your
# computer's name with a maximum size of 600GB and copy it to
# /Volumes/backup. The image "file" (it's a directory, really) will
@noahcampbell
noahcampbell / squid.bash
Created April 14, 2011 00:01
Collectd script for squid
# Steps for turning on squid monitoring (until I have an rpm)
cat > /etc/collectd.d/squid << EOF
LoadPlugin exec
<Plugin exec>
Exec deploy "/var/lib/releng/monitoring/squid"
</Plugin>
EOF
mkdir -p /var/lib/releng/monitoring