Skip to content

Instantly share code, notes, and snippets.

View heyalexej's full-sized avatar

Alexej heyalexej

  • rather hard to pin down
View GitHub Profile
vim updater.bash
bash updater.bash
vim updater.bash
apt-cache search gem
sudo gem install -V lolcat
cowthink heyhey
sudo apt-get install fortune
fortune
man fortune
fortune -o
@heyalexej
heyalexej / cidr-to-ip.py
Created June 20, 2014 06:18
Quick and dirty solution to translate IPv4 and IPv6 CIDR blocks into a list of IPs for further digestion.
#!/usr/bin/env python3
# Translates IPv4/6 CIDR blocks into a list of IPs and writes
# them into a text file. Requires netaddr (pip install netaddr).
import netaddr
ip_list = netaddr.IPNetwork('192.168.1.0/21')
with open('ips-from-cidr.txt', 'w') as f:
for ip in ip_list:

Here are a list of headless browsers that I know about:

  • [HtmlUnit][1] - Java. Custom browser engine. JavaScript support/DOM emulated. Open source.
  • [Ghost][2] - Python only. WebKit-based. Full JavaScript support. Open source.
  • [Twill][3] - Python/command line. Custom browser engine. No JavaScript. Open source.
  • [PhantomJS][4] - Command line/all platforms. WebKit-based. Full JavaScript support. Open source.
  • [Awesomium][5] - C++/.Net/all platforms. Chromium-based. Full JavaScript support. Commercial/free.
  • [SimpleBrowser][6] - .Net 4/C#. Custom browser engine. No JavaScript support. Open source.
  • [ZombieJS][7] - Node.js. Custom browser engine. JavaScript support/emulated DOM. Open source.
  • [EnvJS][8] - JavaScript via Java/Rhino. Custom browser engine. JavaScript support/emulated DOM. Open source.
@heyalexej
heyalexej / install-opera.sh
Created June 23, 2014 17:01
install opera from deb source
#!/bin/bash
# install opera (can change from beta to stable)
# watch out for possible change of pub key later in 2014. http://deb.opera.com/
wget -O - http://deb.opera.com/archive.key | sudo apt-key add -
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A8492E35
sudo sh -c 'echo "# deb http://deb.opera.com/opera/ stable non-free #Opera Browser (final releases)" > /etc/apt/sources.list.d/opera.list'
sudo sh -c 'echo "deb http://deb.opera.com/opera-beta/ stable non-free #Opera Browser (beta releases)" >> /etc/apt/sources.list.d/opera.list'
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install -y opera
import time
import datetime
print "Time in seconds since the epoch: %s" %time.time()
print "Current date and time: " , datetime.datetime.now()
print "Or like this: " ,datetime.datetime.now().strftime("%y-%m-%d-%H-%M")
print "Current year: ", datetime.date.today().strftime("%Y")
print "Month of year: ", datetime.date.today().strftime("%B")
@heyalexej
heyalexej / gist:33bbc7f7e8d5647a9448
Created July 1, 2014 16:33
Python releases by version number
curl -s https://www.python.org/downloads/ | grep -o '/download/releases/[^<]*/' | awk -F/ '{ print $4 }' | cut -c1-3 | sort | uniq
@heyalexej
heyalexej / pg-packs
Created July 12, 2014 20:38
postgres packages
i postgresql - object-relational SQL database (supported
i A postgresql-9.3 - object-relational SQL database, version 9.
i A postgresql-client-9.3 - front-end programs for PostgreSQL 9.3
i A postgresql-client-common - manager for multiple PostgreSQL client ver
i A postgresql-common - PostgreSQL database-cluster manager
i postgresql-contrib - additional facilities for PostgreSQL (supp
i A postgresql-contrib-9.3 - additional facilities for PostgreSQL
@heyalexej
heyalexej / get-going.sh
Created July 14, 2014 21:12
install go through hg
# http://golang.org/doc/go1.2#go_tools_godoc
# Both binaries are still included with the distribution, but the source code
# for the godoc and vet commands has moved to the go.tools subrepository."
# a handful of nifty commands for installation through hg
export GOBIN=~/bin
export GOPATH=~/gocode
mkdir -p /tmp/upstream
mkdir -p ~/gocode
cd /tmp/upstream
hg clone https://code.google.com/p/go/
@heyalexej
heyalexej / mysql-password-reset.sh
Created July 16, 2014 01:34
reset mysql password
#!/usr/bin/env sh
set -e
# Stop MySQL
sudo /etc/init.d/mysql stop
# Start MySQL skipping checks
sudo mysqld --skip-grant-tables &
# Log in as root
@heyalexej
heyalexej / cloaking
Created October 1, 2014 13:54
cloaking, still works like a charm. https://www.google.com/search?q=buy+cialis
curl -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6,th;q=0.4,ru;q=0.2' -H 'Referer: http://google.com' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' -I -L http://www.johnkay.com/purchase-cialis/
HTTP/1.1 302 Moved Temporarily
Date: Wed, 01 Oct 2014 13:16:42 GMT
Server: Apache
X-Powered-By: PHP/5.4.32
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Location: http://online-stats24.com/r.pl?niche=nch&page=aHR0cDovL3d3dy5qb2hua2F5LmNvbS9wdXJjaGFzZS1jaWFsaXMv&ref=http%3A%2F%2Fgoogle.com
Keep-Alive: timeout=2, max=200
Connection: Keep-Alive