Skip to content

Instantly share code, notes, and snippets.

# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
@passos
passos / Dumper.py
Last active March 24, 2023 02:55
A perl Data.Dumper clone for Python
"""
A perl Data.Dumper clone for Python
Author: simon@log4think.com
2011-07-08
Copyright 2011 Jinyu LIU
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:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
@tonious
tonious / hash.c
Last active June 21, 2024 00:57
A quick hashtable implementation in c.
/* Read this comment first: https://gist.github.com/tonious/1377667#gistcomment-2277101
* 2017-12-05
*
* -- T.
*/
#define _XOPEN_SOURCE 500 /* Enable certain library functions (strdup) on linux. See feature_test_macros(7) */
#include <stdlib.h>
#include <stdio.h>
@mattm7n
mattm7n / gist:1405067
Created November 29, 2011 14:54
Monitor DHCP traffic with tcpdump
# Monitoring on interface eth0
tcpdump -i eth0 -n port 67 and port 68
@kasparsd
kasparsd / wordpress-plugin-svn-to-git.md
Last active July 6, 2024 15:54
Using Git with Subversion Mirroring for WordPress Plugin Development
@anunay
anunay / modsecurity-whitelist.conf
Last active December 9, 2022 14:08
Whitelist IP in ModSecurity (whitelist.conf)
##Whitelist IP in ModSecurity
#1. If you need to whitelist an IP in ModSecurity (v2.7+), here’s what to do:
nano /usr/local/apache/conf/modsec2/whitelist.conf
#2. add this line, replacing (#####) with a unique ID number for mod security, I used a version of my whitelisted ip address:
SecRule REMOTE_ADDR "@ipMatch 1.2.3.4" "phase:1,t:none,nolog,allow,ctl:ruleEngine=Off,ctl:auditEngine=Off,id:(#####)"
#3. Then restart apache.
@lrq3000
lrq3000 / pylistmodules.py
Last active September 17, 2023 19:27
List recursively all imports of modules along with versions done from your Python application. Tested on Python 2.7. No dependencies except standard Python libs.
#!/usr/bin/env python
# encoding: utf-8
# Copyright (C) 2001-2007 Martin Blais. All Rights Reserved
# Copyright (C) 2010 Bear http://code-bear.com/bearlog/
# Copyright (C) 2013 lrq3000
# Excerpt from SnakeFood to recursively list all imports of modules using AST parsing
# Additions to print the versions of each module if available
from textblob.classifiers import NaiveBayesClassifier
from textblob import TextBlob
train = [
('I love this sandwich.', 'pos'),
('This is an amazing place!', 'pos'),
('I feel very good about these beers.', 'pos'),
('This is my best work.', 'pos'),
("What an awesome view", 'pos'),
('I do not like this restaurant', 'neg'),
@karelin
karelin / Dumper.py
Last active September 29, 2016 18:19 — forked from passos/Dumper.py
"""
A perl Data.Dumper clone for Python
Author: simon@log4think.com
2011-07-08
"""
#!/bin/env python
import sys
from types import *
Name: mcrouter
Version: 1.0.0
Release: 1%{?dist}
License: BSD
URL: https://github.com/facebook/mcrouter
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: glibc-devel m4 autoconf gcc gcc-c++ openssl-devel
BuildRequires: gflags-devel glog-devel
Source0: https://github.com/facebook/mcrouter/archive/master.tar.gz
Summary: Memcached protocol router for scaling memcached deployments