Skip to content

Instantly share code, notes, and snippets.

@hyperair
hyperair / suniq.cpp
Last active December 16, 2015 20:09 — forked from alisaifee/suniq.cpp
Rewritten sort | uniq -c | sort -n[r] that works faster than the original.
#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <unordered_map>
#include <map>
#include <iterator>
template <typename Iter>
void print (Iter i, Iter end)
@hyperair
hyperair / focus-messaging-menu
Created June 6, 2013 09:26
Script to open the messaging menu in Ubuntu, meant to be bound to a keybinding for easy keyboard access to the messaging menu. It currently uses xdotool to move the mouse to a hardcoded offset from the right edge of the unity panel of the active monitor. This could use some improvement with a utility that could actually search for the actual loc…
#!/bin/sh -e
#
# Copyright (C) 2013 Chow Loong Jin <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@hyperair
hyperair / gist:6806494
Created October 3, 2013 07:44
Workaround for ExpatError when talking to bugzilla servers
import bugzilla
import xmlrpclib
import types
import unicodedata
class FilterParser(object):
"""
Filtering object that strips control characters before actually parsing
"""
def __init__(self, parser):
@hyperair
hyperair / wlan-watchdog
Created October 22, 2013 09:58
A simple watchdog daemon that checks for wpa_supplicant attempting to reestablish the connection and temporarily removes wlan0 from the bridge it is connected to.
#!/bin/sh
# wlan-watchdog -- a simple watchdog daemon that checks for wpa_supplicant
# attempting to reestablish the connection and temporarily removes wlan0 from
# the bridge.
#
# Copyright 2013 Chow Loong Jin <[email protected]>
# Licensed under WTFPL
#
# This is a workaround for a weird bug in iwl4965 where wpa_supplicant is not
# able to complete authentication when attached to a bridge, with error messages
@hyperair
hyperair / grson
Last active December 29, 2015 15:09
grson -- greppable JSON dumper
#!/usr/bin/python3
import json
import sys
fmt = '{key} = {value}'
def dump_obj(prefix, obj):
if isinstance(obj, dict):
for k, v in obj.items():
This file has been truncated, but you can view the full file.
; generated by Slic3r 1.1.3 on 2014-06-03 at 19:33:56
; perimeters extrusion width = 0.40mm
; infill extrusion width = 0.67mm
; solid infill extrusion width = 0.67mm
; top infill extrusion width = 0.20mm
; support material extrusion width = 0.18mm
M127 ; disable fan
M109 S115 ; wait for bed temperature to be reached
@hyperair
hyperair / gist:177b5d84eabf0f39e352
Created June 11, 2014 17:48
G-code for calibration cube
; generated by Slic3r 1.1.4 on 2014-06-12 at 00:56:51
; perimeters extrusion width = 0.40mm
; infill extrusion width = 0.56mm
; solid infill extrusion width = 0.56mm
; top infill extrusion width = 0.56mm
; support material extrusion width = 0.40mm
G21 ; set units to millimeters
M127 ; disable fan
#include <iostream>
#include <fstream>
#include <sstream>
#include <unordered_map>
#include <string>
#include <cstring>
#include <exception>
#include <memory>
This file has been truncated, but you can view the full file.
; generated by Slic3r 1.2.0 on 2014-08-15 at 00:46:56
; external perimeters extrusion width = 0.40mm
; perimeters extrusion width = 0.60mm
; infill extrusion width = 0.60mm
; solid infill extrusion width = 0.60mm
; top infill extrusion width = 0.40mm
; support material extrusion width = 0.40mm
G21 ; set units to millimeters
# generated by Slic3r 1.2.0 on Fri Aug 15 09:36:06 2014
avoid_crossing_perimeters = 0
bed_shape = -112.5x-72.5,112.5x-72.5,112.5x72.5,-112.5x72.5
bed_temperature = 70
bottom_solid_layers = 6
bridge_acceleration = 0
bridge_fan_speed = 100
bridge_flow_ratio = 1
bridge_speed = 10
brim_width = 1