Skip to content

Instantly share code, notes, and snippets.

View notsobad's full-sized avatar

notsobad notsobad

View GitHub Profile
What exactly is "iowait"?
To summarize it in one sentence, 'iowait' is the percentage
of time the CPU is idle AND there is at least one I/O
in progress.
Each CPU can be in one of four states: user, sys, idle, iowait.
Performance tools such as vmstat, iostat, sar, etc. print
out these four states as a percentage. The sar tool can
print out the states on a per CPU basis (-P flag) but most
@karmi
karmi / .gitignore
Last active November 12, 2022 12:11
Example Nginx configurations for Elasticsearch (https://www.elastic.co/blog/playing-http-tricks-nginx)
nginx/
!nginx/.gitkeep
!nginx/logs/.gitkeep
src/
tmp/
@hgenru
hgenru / hello.py
Last active April 5, 2017 10:15
Tornado testing 4.0.1 WTF
from tornado.web import RequestHandler
class HelloHandler(RequestHandler):
def get(self):
self.write('Hello world!')
@morhekil
morhekil / nginx.conf
Created August 14, 2014 12:18
Full request/response body logging in nginx
http {
log_format bodylog '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" $request_time '
'<"$request_body" >"$resp_body"';
lua_need_request_body on;
set $resp_body "";
body_filter_by_lua '
@bsweger
bsweger / useful_pandas_snippets.md
Last active April 19, 2024 18:04
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

@sergiotapia
sergiotapia / md5-example.go
Last active December 5, 2023 03:53
Golang - How to hash a string using MD5.
import (
"crypto/md5"
"encoding/hex"
)
func GetMD5Hash(text string) string {
hasher := md5.New()
hasher.Write([]byte(text))
return hex.EncodeToString(hasher.Sum(nil))
}
@grenade
grenade / sane-gnome-settings.sh
Last active February 4, 2024 08:11
my personal gnome and fedora setup preferences
# Sane settings for Gnome
gsettings set org.gnome.desktop.background show-desktop-icons true
gsettings set org.gnome.desktop.interface clock-show-date true
gsettings set org.gnome.settings-daemon.plugins.xsettings antialiasing 'grayscale'
gsettings set org.gnome.settings-daemon.plugins.xsettings hinting 'slight'
gsettings set org.gnome.desktop.interface text-scaling-factor '1.0'
gsettings set org.gnome.desktop.interface monospace-font-name "Monospace 10"
gsettings set org.gnome.desktop.interface document-font-name 'Sans 10'
gsettings set org.gnome.desktop.interface font-name 'Cantarell 10'
gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita'
@ssstonebraker
ssstonebraker / sed cheatsheet
Created August 2, 2013 14:06 — forked from un33k/sed cheatsheet
Sed Cheatsheet
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@yonjah
yonjah / gist:5082855
Last active February 10, 2023 19:25
Blocking DDOS bots with JavaScript for fun and profit! Or how easy it is to break the current protection methods and how to make it better.
TL;DR - jump to the challenge at the end
====ON BLOCKING EVIL BOTS=====
On a resent job interview I had for "Incapsula" a few days ago I was put to the challenge to break
their bot protection mechanism. Apparently node.js is not that common among bot writes and most bots
are not able to run javascript.
The challenge had two parts -
1. find what the code does.
2. implement a bot that will break the code without using js.
3. think how to make this code unbreakable
@NV
NV / most_used_css_property_names.js
Created September 19, 2012 18:47
PhantomJS script to collect most used CSS property names (supported by WebKit)
// phantomjs --web-security=no most_used_css_property_names.js
var urls = [
'http://google.com',
'http://facebook.com',
'http://youtube.com',
'http://yahoo.com',
'https://github.com/',
'http://twitter.com/',
'http://en.wikipedia.org/wiki/Main_Page',