Skip to content

Instantly share code, notes, and snippets.

Avatar

Olaf Gladis hwmrocker

View GitHub Profile
@hwmrocker
hwmrocker / reclaimWindows10.ps1
Created Jan 11, 2017 — forked from alirobe/reclaimWindows10.ps1
"Reclaim Windows 10" turns off a bunch of unnecessary Windows 10 telemetery, removes bloatware, and privacy invasions. Review and tweak before running. Scripts for reversing are included and commented. Fork via https://github.com/Disassembler0 (different defaults)
View reclaimWindows10.ps1
##########
# Win10 Initial Setup Script
# Author: Disassembler <disassembler@dasm.cz>
# Version: 1.7, 2016-08-15
# dasm's script: https://github.com/Disassembler0/Win10-Initial-Setup-Script/
# THIS IS A PERSONALIZED VERSION
# This script leaves more MS defaults on, including MS security features.
# Tweaked based on personal preferences for @alirobe 2016-11-16 - v1.7.1
View example_wlan_ssid_parser.py
#/usr/bin/env python
import re
import subprocess
def get_networks_in_range_fast(lines=None):
if lines is None:
lines = subprocess.check_output(['nmcli', 'dev', 'wifi', 'list']).splitlines()
re_key = re.compile(r'[A-Z]+\s*')
first_line = lines[0]
keylist = []
View keybase.md

Keybase proof

I hereby claim:

  • I am hwmrocker on github.
  • I am hwmrocker (https://keybase.io/hwmrocker) on keybase.
  • I have a public key whose fingerprint is 3D54 D870 C32B 4778 2FF5 71B3 94DB A9BC 6517 8870

To claim this, I am signing this object:

View Python Meta Foo
class UniqueMeta(type):
def __new__(cls, *foo, **kw):
tmp = type.__new__(cls, *foo, **kw)
tmp._COUNTER = 0
return tmp
class UniquePizza(metaclass=UniqueMeta):
View lsprofcalltree.py
# Copyright (c) 2014
# David Allouche
# Jp Calderone & Itamar Shtull-Trauring
# Johan Dahlin
# Olaf Gladis
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
View README.md

Python development using Pants

brian wickman - @wickman

[TOC]

Why use Pants for Python development?

Pants makes the manipulation and distribution of hermetically sealed Python environments

@hwmrocker
hwmrocker / water.py
Last active Dec 27, 2015
twitter wall problem
View water.py
# used the skeleton from https://gist.github.com/igor47/7228586
def water(levels):
lefties = [(levels[0],0)]
volume = 0
for level in levels[1:]:
lefties = [(lelft_level, distance+1) for lelft_level, distance in lefties]
mini = lefties[-1][0]
maxi = lefties[0][0]
if level < mini:
View example.py
for user_id in d.getUsers():
filen = "out/%s.png" % user_id
if os.path.exists(filen):
continue
i += 1
if i > 20:
exit(0) # we are not done yet
# ... build the figure
fig.savefig(filen, dpi=300)
print "done..."
View python-monkey-patch-built-ins.py
# found this from Armin R. on Twitter, what a beautiful gem ;)
import ctypes
from types import DictProxyType, MethodType
# figure out side of _Py_ssize_t
if hasattr(ctypes.pythonapi, 'Py_InitModule4_64'):
_Py_ssize_t = ctypes.c_int64
else:
_Py_ssize_t = ctypes.c_int
@hwmrocker
hwmrocker / gist:4944245
Last active Dec 13, 2015 — forked from ruxkor/cmp.coffee
coffescript deep compare
View gist:4944245
# comparison function, checking also the contents of elements if we are comparing 2 arrays.
# very useful for sorting.
cmp = (a,b) ->
typemap =
'null': 0
'undefined': 0
'number': 1
'string': 1
'object': 2
You can’t perform that action at this time.