Skip to content

Instantly share code, notes, and snippets.

Avatar
💚
Lobe

Adam Menges adammenges

💚
Lobe
View GitHub Profile
View fib.py
def fib(n):
return reduce(lambda x, y: [x[1], x[0] + x[1]], xrange(n-2), [0, 1])[1]
View isUnique.py
from collections import defaultdict
def isUnique(string):
seen = defaultdict(lambda: False)
for x in string:
if not seen[x]: seen[x] = True
else: return False
return True
View netgear_telnet_enabler.rb
require 'msf/core'
require 'crypt/blowfish' # sorry, openssl is limited to 16-byte key size :(
# add gem 'crypt', '1.1.4' to Gemfile
module ::Crypt
class Blowfish
def setup_blowfish()
@sBoxes = Array.new(4) { |i| INITIALSBOXES[i].clone }
@pArray = INITIALPARRAY.clone
keypos = 0
View gist:d2c0bca7380f33288cdb
TASK: [common | upgrade system packages] **************************************
failed: [celery_stats_testing] => {"failed": true, "item": ""}
stdout: Reading package lists...
Building dependency tree...
Reading state information...
Initializing package states...
Writing extended state information...
Resolving dependencies...
The following NEW packages will be installed:
liblcms2-2{a} linux-headers-3.2.0-64{a} linux-headers-3.2.0-64-virtual{a}
View gist:c1cb3024040025a5b706
$(document).ready(function() {
var closeMenu = function() {
$('#container').unbind('touchmove');
$("#container").animate({"margin-left": "0"}, {
duration: 700,
complete: function() {
$('#content').css('width', 'auto');
$('#contentLayer').css('display', 'none');
View gist:79c7d21833fd33243d6f
with open('./search/data/seo_service_landing_service_data.yml') as f:
service_data = yaml.safe_load(f)
for x in service_data:
service_data[x]['see_also'] = [TOP_TEN[i] for i in (random.sample(xrange(len(TOP_TEN)), 4))]
with open('./search/data/seo_service_landing_service_data.yml', 'w') as f:
pyaml.dump(service_data, f)
View balancedParens.py
def balancedParens(s):
stack, opens, closes = [], ['(', '[', '{'], [')', ']', '}']
for c in s:
if c in opens:
stack.append(c)
elif c in closes:
try:
if opens.index(stack.pop()) != closes.index(c):
return False
except (ValueError, IndexError):
@adammenges
adammenges / youtube.py
Last active Aug 29, 2015
Download whole playlist of videos from youtube with Python
View youtube.py
#############################
#
# Needed it to download this guy: https://www.youtube.com/playlist?list=PLPemlF-zX2ydW5QoNsHpQiLCQKIKdjvoo
#
# Figured why not stick it up on github too.
#
#############################
import pafy
import os
View gist:71b3ac3d851b59de3ddb
### Keybase proof
I hereby claim:
* I am adammenges on github.
* I am adammenges (https://keybase.io/adammenges) on keybase.
* I have a public key whose fingerprint is 4C50 C670 FDCD 994E EC08 D308 C8A2 1C16 63B6 3476
To claim this, I am signing this object:
View ml-bot.py
##############################################################################
## ##
## ##
## ( \/ )( ) ___( _ \ / \(_ _) ##
## / \/ \/ (_/\(___)) _ (( O ) )( ##
## \_)(_/\____/ (____/ \__/ (__) ##
## ##
## ##
## ##
## The beginings of an ml-bot. To start, he'll let us know when ##