Skip to content

Instantly share code, notes, and snippets.

View gnilchee's full-sized avatar

Greg Nilchee gnilchee

  • Evernote
  • Woodinville, WA
View GitHub Profile
@marcelom
marcelom / pysyslog.py
Created December 5, 2012 18:06
Tiny Python Syslog Server
#!/usr/bin/env python
## Tiny Syslog Server in Python.
##
## This is a tiny syslog server that is able to receive UDP based syslog
## entries on a specified port and save them to a file.
## That's it... it does nothing else...
## There are a few configuration parameters.
LOG_FILE = 'youlogfile.log'
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active April 20, 2024 16:52
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@weapp
weapp / nginx.conf
Created August 4, 2014 17:21
Return common errors as json in Nginx
error_page 500 /500.html;
location /500.html{
return 500 '{"error": {"status_code": 500,"status": "Internal Server Error"}}';
}
error_page 502 /502.html;
location /502.html{
return 502 '{"error": {"status_code": 502,"status": "Bad Gateway"}}';
}
@ghoseb
ghoseb / factorial.py
Created November 14, 2008 18:58
The evolution of a Python Programmer
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
@mapbutcher
mapbutcher / EnableWinRm
Created July 17, 2013 01:19
Enable WinRM with basic auth
set-executionpolicy -executionpolicy remotesigned
winrm quickconfig -q
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="512"}'
winrm set winrm/config '@{MaxTimeoutms="1800000"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
@dctrwatson
dctrwatson / nginx.conf
Last active March 19, 2023 08:56
Caching PyPi packages locally with nginx
user www-data;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@mestizo
mestizo / gist:9167834
Last active February 27, 2023 22:39
Completely disable IPv6 on OSX
#To Get List of Hardware
sudo networksetup -listallhardwareports
#To Disable IPv6 on Wifi Adapter
sudo networksetup -setv6off wi-fi
#To Disable IPv6 on Built-in Ethernet Adapter
sudo networksetup -setv6off Ethernet
@z0mbix
z0mbix / tcpdump-es-capture
Created December 19, 2014 14:45
Capture Elasticsearch Queries
# tcpdump -A -nn -s 0 'tcp dst port 9200 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' -i lo
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on lo, link-type EN10MB (Ethernet), capture size 65535 bytes
14:32:33.525122 IP 127.0.0.1.49777 > 127.0.0.1.9200: Flags [P.], seq 313752908:313753888, ack 2465010394, win 257, options [nop,nop,TS val 2684167067 ecr 2684167066], length 980
E...^.@.@............q#...}L...............
..#...#.GET /index/_search HTTP/1.1
Host: 127.0.0.1:9200
Accept: */*
Content-Length: 845
Content-Type: application/x-www-form-urlencoded
@dsuch
dsuch / haproxy.conf
Created June 26, 2013 22:18
HAProxy config for URL-based rate limiting
# At most 10 concurrent connections from a client
acl too_fast fe_sess_rate ge 10
# Matches any path beginning with a given prefix
acl bursts_inclined path_beg -i /client1
# Effectively working as a delay mechanism for clients that are too fast
tcp-request inspect-delay 1000ms
# Fast-path - accept connection if it's not this troublesome client