Skip to content

Instantly share code, notes, and snippets.

//: Playground - noun: a place where people can play
import UIKit
// Basic functions
func add(a: Int, b: Int) -> Int {
return a + b
}
@damouse
damouse / keymapping.h
Last active December 15, 2016 23:38
Keymapping for qmk_firmware on an OLKB Atomic. From: keyboards/atomic/damouse
#include "atomic.h"
/* QWERTY
* .---------------------------------------------------------------------------------------------------------------------- 2u ------------.
* | ESCAPE | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BACKSP | DEL
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------|
* | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | END |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- ---------------+--------|
* | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER | VOL UP| PG UP |
'''
A collection of adjectives and nouns. Useful for generating names with haikunator.
https://github.com/Atrox/haikunatorpy
'''
adjectives = ['aback', 'abaft', 'abandoned', 'abashed', 'aberrant', 'abhorrent', 'abiding', 'abject', 'ablaze', 'able', 'abnormal', 'aboard', 'aboriginal', 'abortive', 'abounding', 'abrasive', 'abrupt', 'absent', 'absorbed', 'absorbing', 'abstracted', 'absurd', 'abundant', 'abusive', 'acceptable', 'accessible', 'accidental', 'accurate', 'acid', 'acidic', 'acoustic', 'acrid', 'actually', 'ad', 'hoc', 'adamant', 'adaptable', 'addicted', 'adhesive', 'adjoining', 'adorable', 'adventurous', 'afraid', 'aggressive', 'agonizing', 'agreeable', 'ahead', 'ajar', 'alcoholic', 'alert', 'alike', 'alive', 'alleged', 'alluring', 'aloof', 'amazing', 'ambiguous', 'ambitious', 'amuck', 'amused', 'amusing', 'ancient', 'angry', 'animated', 'annoyed', 'annoying', 'anxious', 'apathetic', 'aquatic', 'aromatic', 'arrogant', 'ashamed', 'aspiring', 'assorted', 'astonishing', 'attractive', 'auspicious', 'aut
@damouse
damouse / ubuntu.sh
Last active April 3, 2018 17:43
Clean up Ubuntu bloatware and extras.
# unity
sudo apt-get purge --quiet --assume-yes unity-scope-calculator \
unity-scope-chromiumbookmarks \
unity-scope-colourlovers \
unity-scope-devhelp \
unity-scope-firefoxbookmarks \
unity-scope-manpages \
unity-scope-musicstores \
unity-scope-openclipart \
unity-scope-texdoc \
/* Copyright 2015-2017 Jack Humbert
*
* 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty ofqwerqweasdfzxcv
* GNU General Public License for more details.
# Exact Solarized Dark color theme for the color GNU ls utility.
# Designed for dircolors (GNU coreutils) 5.97
#
# This simple theme was simultaneously designed for these terminal color schemes:
# - Solarized dark (best)
# - Solarized light
# - default dark
# - default light
# with a slight optimization for Solarized Dark.
#
[
{
"class": "title_bar",
"fg": ["background", 255, 255, 255, 0.7],
"bg": ["background", 0, 0, 0, 0.4]
},
{
"class": "title_bar",
"attributes": ["file_dark"],
"bg": ["background", 255, 255, 255, 0.15]
@damouse
damouse / .bashrc
Last active June 12, 2018 22:03
Personal bashrc, shared and updated among many, many machines running all kinds of OS. Self updating with rcpush and rcpull.
# Damouse's autoupdateing bash script, with autoupdating and sublime syncing
#
# To install: remove .bashrc, git clone git@github.com:85e8f43913f591e2d0fa.git, and move contents into home directory
#
# Go commands required for GoOracle:
# go get -u golang.org/x/tools/cmd/goimports
# go get -u golang.org/x/tools/cmd/vet
# go get -u golang.org/x/tools/cmd/oracle
# go get -u golang.org/x/tools/cmd/godoc
#
@damouse
damouse / async_bluetoothctl.py
Last active September 6, 2018 18:00
Bluetoothctl text interface with asyncio in Python3.6
"""
A hilarious way to avoid writing DBus implementations by hooking into bluetoothd via the text interface
presented by bluetoothctl. You can do anything bluetoothctl can do except see live events.
In my case, I needed simple ability to pair with an Xbox One controller in python 3.6 with asyncio,
and getting dbus set up made my teeth hurt. This implementation is half serious-- its written to back
honest-to-god production software, but I can't in good conscious advise you to ever use it.
Tested with bluez 5.41 and 5.55, python3.6, and ubuntu 16.04. The only dependency is pexpect, which you
can install with:
"""
Print out the ANSI color codes for testing.
"""
import sys
for i in range(0, 16):
for j in range(0, 16):
code = str(i * 16 + j)
sys.stdout.write(u"\u001b[38;5;" + code + "m " + code.ljust(4))