Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am pgroudas on github.
  • I am pgroudas (https://keybase.io/pgroudas) on keybase.
  • I have a public key ASCXmYtWc-_HvA1buI9uck1O02gJj5emPNRhRdZdd6Qvcwo

To claim this, I am signing this object:

@pgroudas
pgroudas / foobar.py
Created November 26, 2017 15:23
Global reassignment Python example
def foo(x):
return x
def reassign(y):
# Must have this line to tell the interpreter that you mean the outer 'foo' reference, not a new, locally scoped one.
global foo
if y:
foo = lambda x: x + 1
else:
foo = lambda x: x - 1
2222222222222222222222222222222222222222222222222222222222222222222222222666666666666666666666666666666666666699999999999999999999999999999999999999999999996666666666666666666666666666666669999999999999999999999999999999999999666666666666666666666666666666666666666669999999999999999999999999999999999999966666666666666666666666666666666666666666669999999999999999999999955555555555555555555555444444444444444111111111111111111122222222222222222222222333333333333333333333333333344444444444444444444445555555555555555555555566666666666666666666664444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444477777777777777777777777777777777777777777777777778888888888888888888888888888888888888889999999999999999999999999899999999999999998999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999899999999999999999999999999999999999999999999999999999999999999999999999999999999999999991111111111111111111
@pgroudas
pgroudas / iptables
Last active December 15, 2015 07:49
dd-wrt firewall
# ----------------------
#--- IPTABLES START ---
# ----------------------
#
# DEFINES:
LAN_IP=$(nvram get lan_ipaddr)
WAN_IP=$(nvram get wan_ipaddr)
# ---
require 'net/http'
require 'json'
auth_token = '<put_the_auth_token_you_get_back_here>'
search_endpoint = 'http://localhost:5000/listing/'
login_endpoint = 'http://localhost:5000/login'
json = JSON.dump(
{
"email"=>"foo@urbancompass.com",
"password"=>"password"
@pgroudas
pgroudas / dell.seed
Created August 29, 2012 17:18
ubuntu 12.04 preseed file
#### Contents of the preconfiguration file (for squeeze)
### Localization
# Preseeding only locale sets language, country and locale.
d-i debian-installer/locale string en_US
# The values can also be preseeded individually for greater flexibility.
#d-i debian-installer/language string en
#d-i debian-installer/country string NL
#d-i debian-installer/locale string en_GB.UTF-8
# Optionally specify additional locales to be generated.
@pgroudas
pgroudas / downgrade_libqt.sh
Created August 29, 2012 13:25
Downgrade libqt on ubuntu 12.04
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
cat >>/etc/apt/sources.list <<END
# Needed for older versions of libqt (needed for cucumber and capybara/webkit)
deb http://archive.ubuntu.com/ubuntu oneiric main
END
apt-get update
apt-get remove -y libqtwebkit-dev libqt4-dev
@pgroudas
pgroudas / test.pig
Created May 1, 2012 19:41
Simple test.pig
REGISTER 's3n://intentmedia-hawk-output/paul/jars/jsonStorage.jar';
DEFINE JsonStorage org.apache.pig.builtin.JsonStorage();
-- Load up the million song dataset from S3 (see data spec at: http://bit.ly/vOBKPe)
songs = LOAD 's3n://tbmmsd/T.tsv.j' USING PigStorage('\t') AS (
track_id:chararray, analysis_sample_rate:chararray, artist_7digitalid:chararray,
artist_familiarity:chararray, artist_hotness:double, artist_id:chararray, artist_latitude:chararray,
artist_location:chararray, artist_longitude:chararray, artist_mbid:chararray, artist_mbtags:chararray,
artist_mbtags_count:chararray, artist_name:chararray, artist_playmeid:chararray, artist_terms:chararray,
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@pgroudas
pgroudas / .irbrc
Created November 22, 2011 21:10
Simple .irbrc
#!/usr/bin/ruby
require 'irb/completion'
require 'irb/ext/save-history'
require 'rubygems'
IRB.conf[:USE_READLINE] = true
IRB.conf[:SAVE_HISTORY] = 1000
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history"
IRB.conf[:PROMPT_MODE] = :SIMPLE