Skip to content

Instantly share code, notes, and snippets.

View tzermias's full-sized avatar

Zacharias Tzermias tzermias

View GitHub Profile
@tzermias
tzermias / ubuntu.ipxe
Last active October 13, 2015 00:57
Netboot Ubuntu 12.04 (32-bit) from ftp.ntua.gr using iPXE (taken from gist.github.com/2234639.git)
#!ipxe
# Set server where image will be downloaded.
# archive.ubuntu.com works fine but you can use your own.
set server archive.ubuntu.com
# Specify a distro
# Just type the distro codename here...
set distro quantal
@tzermias
tzermias / ip_forward.md
Last active March 20, 2024 02:06
Forward traffic from wlan0 to eth0 interface

Forward traffic from a laptop's eth0 to wlan0

###To laptop

Specify an IP address to eth0 (here 192.168.56.1)

sudo ifconfig eth0 192.168.56.1 netmask 255.255.255.0
@tzermias
tzermias / pipelines.py
Last active March 14, 2024 23:35
Scrapy MySQL pipeline. Just a mirror to the asynchronous MySQL pipeline. Copy-paste it directly to pipelines.py. Database credentials are stored in settings.py. Based on http://snipplr.com/view/66986/
import MySQLdb.cursors
from twisted.enterprise import adbapi
from scrapy.xlib.pydispatch import dispatcher
from scrapy import signals
from scrapy.utils.project import get_project_settings
from scrapy import log
SETTINGS = get_project_settings()
#!/usr/bin/env python
# encoding: utf-8
import tweepy #https://github.com/tweepy/tweepy
import csv
#Twitter API credentials
consumer_key = ""
consumer_secret = ""
access_key = ""
@tzermias
tzermias / geoip_demo.py
Created January 7, 2014 21:38
Script that queries the GEOIP2 Precision Demo by Maxmind from the commandline. Not fully tested.
#! /usr/bin/env python
import urllib2
import json
import sys
def main(args):
if len(args) != 2:
print "%s IPADDR" % args[0]
exit(255)
@tzermias
tzermias / rate_limit.py
Created January 14, 2014 13:03
Find which method of the Twitter API (via tweepy) doesn't have any available requests.
rate_limit = api.rate_limit_status()
[key2 for key in rate_limit['resources'] for key2 in rate_limit['resources'][key].keys() if rate_limit['resources'][key][key2]['remaining']==0]
#!/usr/bin/php
<?php
# Senderbase Monitoring Plugin for Nagios
# Dan Miller <dm@sub6.com>
error_reporting(E_ERROR | E_PARSE);
# Function to swap the octets of an IP...
# ..address around in to ARPA formatting.

Keybase proof

I hereby claim:

  • I am tzermias on github.
  • I am tzermias (https://keybase.io/tzermias) on keybase.
  • I have a public key whose fingerprint is A5A5 CA5F 3942 49F8 10AF 0B8F 4EB4 A0C3 B597 E551

To claim this, I am signing this object:

@tzermias
tzermias / racktables.py
Created March 17, 2015 09:38
A simple script that parses data from the show "mac address-table" command of Dell Poweredge 5548 switch, and updates a specific network switch object in Racktables.
#! /usr/bin/env python
""" racktables.py
Simple script that parses data from 'show mac address-table' command of Dell
Poweredge 5548 switch, and updates the Racktables DB accordingly
a.tzermias@tophost.gr
"""
@tzermias
tzermias / plesk.fact
Created September 3, 2015 14:09
Ansible fact for retrieving plesk version
#!/bin/bash
VERSION=$(awk '{print $1}' /usr/local/psa/version)
VERSION_MAJOR=$(echo $VERSION | cut -d'.' -f1)
cat <<EOF
{
"plesk_version" : "$VERSION",
"plesk_version_major" : "$VERSION_MAJOR"
}