Skip to content

Instantly share code, notes, and snippets.

View hsoc's full-sized avatar

John Economou hsoc

View GitHub Profile
@dansimau
dansimau / pglag.sh
Created January 9, 2012 11:58
Calculate the replication lag between postgresql master and one or more slaves in streaming replication mode.
#!/bin/bash
#
# Show replication lag for one or more postgresql slaves in streaming replication.
#
# dsimmons@squiz.co.uk
# 2012-01-09
#
psql="which psql"
psql_extra_opts=""
@psychok7
psychok7 / GIT Commands
Last active November 13, 2021 09:53
GIT Quick Commands
#On local machine
cd foo (your project folder parent)
git init
git add -A * (doesnt add empty folders, be carefull with netbeans config files)
git commit -m "My initial commit message"
#On local machine, in your git project
git remote add origin https://psychok7@bitbucket.org/psychok7/human-computer-interaction.git
git push origin master
@naiquevin
naiquevin / thankyou.py
Last active September 16, 2020 16:09
Python script to thank people who sent birthday wishes on facebook
import sys
from urllib import urlencode
import requests
from urlparse import urlparse, parse_qs
from random import choice
import re
self_id = None # your facebook id here
utc_bday = None # utc timestamp of your birthday
@willurd
willurd / web-servers.md
Last active June 21, 2024 13:36
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@jasonrudolph
jasonrudolph / 00-about-search-api-examples.md
Last active April 30, 2024 19:21
5 entertaining things you can find with the GitHub Search API
@denji
denji / http-benchmark.md
Last active June 20, 2024 14:22
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)
@xenialaq
xenialaq / essential_packages.sh
Last active November 12, 2017 01:11
Ubuntu Setup (Ubuntu MATE 17.10)
#!/bin/bash
sudo apt-get install -y \
build-essential git curl nano gedit vim kdiff3 ubuntu-make octave \
chromium-browser fcitx cloc gtkhash p7zip gparted baobab gimp pinta uncrustify \
imagemagick meshlab python-nose \
muon okular python3-pyqt4 pavucontrol pulseaudio-equalizer \
redshift redshift-gtk \
openjdk-8-jdk nginx \
xdotool tidy python-gpgme autoconf libqt5opengl5 \
@AysadKozanoglu
AysadKozanoglu / jail.conf
Last active November 2, 2023 00:31
fail2ban nginx 404 400 403 444 filter /etc/fail2ban/filter.d/nginx-4xx.conf enable
# to enable this filter add to jail.conf following (/etc/fail2ban/jail.conf)
# Thanks to -> TheBarret
[nginx-4xx]
enabled = true
port = http,https
logpath = /var/log/nginx/access.log
maxretry = 3
@hans2103
hans2103 / server.badbots
Last active May 8, 2024 17:33
NGINX to block bad bots. (add Twenga|TwengaBot if you want to exclude them too)
if ($http_user_agent ~* (360Spider|80legs.com|Abonti|AcoonBot|Acunetix|adbeat_bot|AddThis.com|adidxbot|ADmantX|AhrefsBot|AngloINFO|Antelope|Applebot|BaiduSpider|BeetleBot|billigerbot|binlar|bitlybot|BlackWidow|BLP_bbot|BoardReader|Bolt\ 0|BOT\ for\ JCE|Bot\ mailto\:craftbot@yahoo\.com|casper|CazoodleBot|CCBot|checkprivacy|ChinaClaw|chromeframe|Clerkbot|Cliqzbot|clshttp|CommonCrawler|comodo|CPython|crawler4j|Crawlera|CRAZYWEBCRAWLER|Curious|Curl|Custo|CWS_proxy|Default\ Browser\ 0|diavol|DigExt|Digincore|DIIbot|discobot|DISCo|DoCoMo|DotBot|Download\ Demon|DTS.Agent|EasouSpider|eCatch|ecxi|EirGrabber|Elmer|EmailCollector|EmailSiphon|EmailWolf|Exabot|ExaleadCloudView|ExpertSearchSpider|ExpertSearch|Express\ WebPictures|ExtractorPro|extract|EyeNetIE|Ezooms|F2S|FastSeek|feedfinder|FeedlyBot|FHscan|finbot|Flamingo_SearchEngine|FlappyBot|FlashGet|flicky|Flipboard|g00g1e|Genieo|genieo|GetRight|GetWeb\!|GigablastOpenSource|GozaikBot|Go\!Zilla|Go\-Ahead\-Got\-It|GrabNet|grab|Grafula|GrapeshotCrawler|GTB5|GT\:\:WWW|Guzz
@daniele-rapagnani
daniele-rapagnani / dump_google_spaces.js
Created March 1, 2017 10:55
Quick and dirty snippet for exporting links from Google Spaces
/**
* This dirty, dirty script, allows you to export links from google spaces
* so that you don't have to do it manually before April 17th.
* I could not find any official way to do this so I quickly threw this script
* together.
*
* USAGE:
* 1. Place yourself on the space page you want to export
* (such as: https://spaces.google.com/space/XXXXXXXXXXXXXXX)
*