Skip to content

Instantly share code, notes, and snippets.

@unixb0y
unixb0y / hosts
Created Apr 25, 2018
hosts file for blocking basically all Google connections
View hosts
##
# Put this AFTER your current
# /etc/hosts file contents!
# After that, either reboot or
# manually flush your DNS cache
##
127.0.0.1 google.com #} redirects to us2.startpage.com:443
127.0.0.1 www.google.com #} 216.218.239.164 is the IP address for the
127.0.0.1 google.ca #} Google frontend Startpage and automatically
@ravisorg
ravisorg / test-hashtag-regexp.php
Last active Dec 13, 2018
pnut.io unicode hashtag parser
View test-hashtag-regexp.php
<?php
// You can find the test data file at https://www.ravis.org/hashtag-test.zip
// You're gonna want to have your console output supporting UTF8 before running this, or you're
// gonna see a bunch of ? in the output...
// For curiosity's sake, post number 693,847 is an emoji hashtag: #(heart)
@sahilsk
sahilsk / load-and-stress-testing-tools.md
Last active Mar 27, 2020
Load and stress testing tools
View load-and-stress-testing-tools.md

wrk is a modern HTTP benchmarking tool capable of generating significant load when run on a single multi-core CPU. It combines a multithreaded design with scalable event notification systems such as epoll and kqueue.

Basic Usage

wrk -t12 -c400 -d30s http://127.0.0.1:8080/index.html
@vdel26
vdel26 / nginx
Last active Apr 16, 2021
Openresty init.d script
View nginx
#!/bin/sh
#
# chkconfig: 2345 55 25
# Description: Nginx init.d script, put in /etc/init.d, chmod +x /etc/init.d/nginx
# For Debian, run: update-rc.d -f nginx defaults
# For CentOS, run: chkconfig --add nginx
#
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
@digitaljhelms
digitaljhelms / gist:4287848
Last active Jul 28, 2021
Git/GitHub branching standards & conventions
View gist:4287848

Branching

Quick Legend

Instance Branch Description, Instructions, Notes
@jkp
jkp / websocketserver.py
Created Jul 18, 2012
A simple WebSockets server with no dependencies
View websocketserver.py
import struct
import SocketServer
from base64 import b64encode
from hashlib import sha1
from mimetools import Message
from StringIO import StringIO
class WebSocketsHandler(SocketServer.StreamRequestHandler):
magic = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'
@lukemorton
lukemorton / README.markdown
Created Jun 4, 2011
Set caret position via jQuery
View README.markdown

jQuery Caret

This is a very simple lightweight plugin to allow you to move the caret (or cursor) position in an <input /> or <textarea> element.

By exposing three jQuery.fn methods you can easily move a a caret to any position you like:

$.fn.caretTo( index , [ offset ] )