Skip to content

Instantly share code, notes, and snippets.

View gnilchee's full-sized avatar

Greg Nilchee gnilchee

  • Evernote
  • Woodinville, WA
View GitHub Profile
@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
@SIN-777
SIN-777 / mysql_total_memory_usage_calculation.sql
Created June 5, 2012 05:10
mysql total memory usage calculation query
-- copied from: http://mogmet.blog20.fc2.com/blog-entry-55.html
select @@GLOBAL.KEY_BUFFER_SIZE + @@GLOBAL.INNODB_BUFFER_POOL_SIZE + @@GLOBAL.INNODB_LOG_BUFFER_SIZE + @@GLOBAL.INNODB_ADDITIONAL_MEM_POOL_SIZE + @@GLOBAL.NET_BUFFER_LENGTH as GLOBAL_BUFFER_SIZE, @@GLOBAL.SORT_BUFFER_SIZE + @@GLOBAL.MYISAM_SORT_BUFFER_SIZE + @@GLOBAL.READ_BUFFER_SIZE + @@GLOBAL.JOIN_BUFFER_SIZE + @@GLOBAL.READ_RND_BUFFER_SIZE as THREAD_BUFFER_SIZE, @@GLOBAL.KEY_BUFFER_SIZE + @@GLOBAL.INNODB_BUFFER_POOL_SIZE + @@GLOBAL.INNODB_LOG_BUFFER_SIZE + @@GLOBAL.INNODB_ADDITIONAL_MEM_POOL_SIZE + @@GLOBAL.NET_BUFFER_LENGTH + (@@GLOBAL.SORT_BUFFER_SIZE + @@GLOBAL.MYISAM_SORT_BUFFER_SIZE + @@GLOBAL.READ_BUFFER_SIZE + @@GLOBAL.JOIN_BUFFER_SIZE + @@GLOBAL.READ_RND_BUFFER_SIZE) * @@GLOBAL.MAX_CONNECTIONS AS TOTAL_MEMORY_SIZE, (@@GLOBAL.KEY_BUFFER_SIZE + @@GLOBAL.INNODB_BUFFER_POOL_SIZE + @@GLOBAL.INNODB_LOG_BUFFER_SIZE + @@GLOBAL.INNODB_ADDITIONAL_MEM_POOL_SIZE + @@GLOBAL.NET_BUFFER_LENGTH + (@@GLOBAL.SORT_BUFFER_SIZE + @@GLOBAL.MYISAM_SORT_BUFF
@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'
@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;
}
@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
@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"}'
@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
@creativepsyco
creativepsyco / gist:9322214
Last active August 29, 2015 13:56
Host Python Server in Current Directory.
#Python 2
python -m SimpleHTTPServer 8080
#Python 3
python3 -m http.server 8113
@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"}}';
}