Skip to content

Instantly share code, notes, and snippets.

View pettazz's full-sized avatar
🤷‍♂️
lol

Nick Pettazzoni pettazz

🤷‍♂️
lol
View GitHub Profile
@pettazz
pettazz / gist:85ac06d189107d1b00b1
Created February 4, 2015 17:51
Bootsnip form steps in 2.3.2
.bs-wizard {padding: 0 0 10px 3px; margin-left: 0px;}
.bs-wizard > .bs-wizard-step {margin: 0 -1px 0 0; padding: 0; position: relative;}
.bs-wizard > .bs-wizard-step + .bs-wizard-step {}
.bs-wizard > .bs-wizard-step .bs-wizard-stepnum {color: #595959; font-weight: bold; font-size: 16px; margin-bottom: 5px;}
.bs-wizard > .bs-wizard-step .bs-wizard-info {color: #999; font-size: 14px;}
.bs-wizard > .bs-wizard-step > .bs-wizard-dot {position: absolute; width: 30px; height: 30px; display: block; background: #fbe8aa; top: 45px; left: 50%; margin-top: -15px; margin-left: -15px; border-radius: 50%;}
.bs-wizard > .bs-wizard-step > .bs-wizard-dot:after {content: ' '; width: 14px; height: 14px; background: #fbbd19; border-radius: 50px; position: absolute; top: 8px; left: 8px; }
.bs-wizard > .bs-wizard-step > .progress {position: relative; border-radius: 0px; height: 8px; box-shadow: none; margin: 20px 0;}
.bs-wizard > .bs-wizard-step > .progress > .bar {width:0px; box-shadow: none; background: #fbe8aa; transition: wid
@pettazz
pettazz / transmission_wait.sh
Created April 6, 2015 19:18
make transmission wait for openvpn
#!/bin/bash
SERVICE=openvpn;
while [[ test $(ps -ef |grep ${SERVICE}) -gt 0 ]]
do
echo "waiting for openvpn..."
sleep 1m
done
@pettazz
pettazz / reset_qcows.sh
Created February 19, 2013 21:48
Updated reset_vms version to use qemu qcows instead of VirtualBox
#!/bin/bash
function reset_vm {
echo "resetting $1..."
cd /home/pettazz/VMs/
if [ -a $1.pid ]
then
echo "killing existing VM pid:"
@pettazz
pettazz / lolpics.js
Created September 15, 2016 01:07
get all the urls from a wedding photo website because im lazy and i wanted to download them all
var urls = [];
var thumbs = $('.tab-frame-content .pg img.pv-img');
var doit = function(idx){
if(idx < thumbs.length){
var el = $(thumbs[idx]);
var link = el.parent('a');
link.trigger('mousedown');
var timeoutID = window.setTimeout(function(){
$('.pf-plane > .pv-ready .pv-inner > img.pv-img').each(function(){
var style = $(this).attr('style');
@pettazz
pettazz / lvm-snapshot-backup.sh
Last active October 15, 2016 16:28
Use LVM snapshots to create a nightly backup of the whole root disk
#!/bin/bash
lvcreate -L2G -s -n /dev/alonso-vg/root-snapshot /dev/alonso-vg/root
dd if=/dev/alonso-vg/root-snapshot bs=16M status=progress | gzip -9 > /backup/alonso.nightly.gz
lvremove -f /dev/alonso-vg/root-snapshot
#!/bin/bash
declare -A oids
#upload
oids["sent-lo"]=".1.3.6.1.2.1.31.1.1.1.10.1"
oids["sent-eth0"]=".1.3.6.1.2.1.31.1.1.1.10.2"
oids["sent-vlan1"]=".1.3.6.1.2.1.31.1.1.1.10.5"
oids["sent-vlan2"]=".1.3.6.1.2.1.31.1.1.1.10.6"
oids["sent-eth1"]=".1.3.6.1.2.1.31.1.1.1.10.11"
@pettazz
pettazz / butwhy.php
Created March 13, 2017 19:13
png image from hex string
<?php
$data = 'blah';
$data = hex2bin($data);
header('Content-Type: image/png');
imagepng(imagecreatefromstring($data));
?>
@pettazz
pettazz / clicks_for_vic.py
Created April 29, 2017 04:22
A great way to run out of memory quick
import threading
import time
from selenium import webdriver
TOTAL_WORKERS = 10
TWITTER_USER = 'butts'
TWITTER_PASSWORD = 'bu77s'
def worker():
@pettazz
pettazz / spaghetti.py
Created April 27, 2016 20:43
really fuck up someone's plex usage with squid
#!/usr/bin/env python
import sys
BAD_PEOPLE = [
'192.168.1.118',
'192.168.1.119'
]
while True:
# squid writes stuff to us via stdin like this:
@pettazz
pettazz / selenium.sh
Created May 8, 2012 16:00
bash script for starting/stopping selenium server from python 2.7's SeleniumLibrary
#!/bin/bash
if [ "$1" == 'stop' ]; then
echo "Stopping selenium server..."
pid=`ps -eo pid,args | grep selenium-server.jar | grep -v grep | cut -c1-6`
kill -9 $pid
elif [ "$1" == 'start' ]; then
echo "Starting selenium server..."
cd /Library/Python/2.7/site-packages/SeleniumLibrary/lib/
java -jar selenium-server.jar &> /dev/null &
else