Skip to content

Instantly share code, notes, and snippets.

View yspreen's full-sized avatar
🦆
Working

Nick Spreen yspreen

🦆
Working
View GitHub Profile
@yspreen
yspreen / index.html
Created January 1, 2017 14:11 — forked from anonymous/index.html
JSON Table Experiment
<div class="container">
<div class="col-md-12">
<table class="table table-striped head">
<thead>
<tr>
<th>Text</th>
<th style="text-align:right">Time</th>
</tr>
</thead>
</table>
@yspreen
yspreen / Board.py
Last active January 15, 2017 13:35
Logiq Tower greedy solver
from Piece import Piece
from copy import deepcopy
class Board:
def __init__(self, data):
self.data = data
def copy(self):
return Board(deepcopy(self.data))
@yspreen
yspreen / django error
Last active September 17, 2017 17:15
Option 1: form = UploadForm(dict(), {'document': File(local_file)})
File "C:\Program Files\Python36\lib\site-packages\django\core\handlers\exception.py" in inner
41. response = get_response(request)
File "C:\Program Files\Python36\lib\site-packages\django\core\handlers\base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "C:\Program Files\Python36\lib\site-packages\django\core\handlers\base.py" in _get_response
@yspreen
yspreen / style.scss
Created March 22, 2018 20:17
SASS ultimate transition mixin [SCSS]
@function remove-nth($list, $index) {
$result: null;
@if type-of($index) != number {
@warn "$index: #{quote($index)} is not a number for `remove-nth`.";
} @else if $index == 0 {
@warn "List index 0 must be a non-zero integer for `remove-nth`.";
} @else if abs($index) > length($list) {
@warn "List index is #{$index} but list is only #{length($list)} item long for `remove-nth`.";
} @else {
@yspreen
yspreen / script.scpt
Last active April 20, 2018 17:40
Fix Chrome Zoom behaviour with Applescript
-- Fix Chrome Zoom by yspreen
set dock_left to 1 -- Specify your dock position here!
set dock_bottom to 0 -- Specify your dock position here!
set dock_right to 0 -- Specify your dock position here!
set menu_bar_height to 22 -- change this!
-- Retina MacBooks probably have higher values.
-- Maximize Chrome, then run this script in the editor to see the output:
-- (*If chrome is currently in full-screen, your menu-bar height is:*)
-- (*22*)
@yspreen
yspreen / windows.json
Created April 20, 2018 16:58
Karabiner configuration for Windows keyboard features
{
"title": "PC Style",
"rules": [
{
"description": "Home / End (except Chrome, Code, iTerm, Terminal and vim)",
"manipulators": [
{
"type": "basic",
"from": {
@yspreen
yspreen / windowsgerman.keylayout
Created April 20, 2018 17:33
macOS keyboard layout for a german windows keyboard
<?xml version="1.1" encoding="UTF-8"?>
<!DOCTYPE keyboard SYSTEM "file://localhost/System/Library/DTDs/KeyboardLayout.dtd">
<!--Last edited by Ukelele version 3.2.7.195 on 2018-04-20 at 19:20 (CEST)-->
<keyboard group="126" id="-5083" name="Deutsch Windows" maxout="1">
<layouts>
<layout first="0" last="4" mapSet="fb0" modifiers="84"/>
<layout first="5" last="5" mapSet="18c" modifiers="84"/>
<layout first="8" last="9" mapSet="18c" modifiers="84"/>
<layout first="13" last="13" mapSet="18c" modifiers="84"/>
</layouts>
@yspreen
yspreen / useful.sh
Last active November 11, 2019 23:21
Useful bash snippets
alias dockerlogs='docker exec -i -t `docker ps | grep '\''python man'\'' | grep -o '\''^[^ ]*'\''` bash'
alias gitrmbranches='git branch --merged | grep -v \* | xargs git branch -D'
git branch -vv | grep 'origin/.*: gone]' | awk '{print $1}' | xargs git branch -d
alias random_pw='LC_ALL=C tr -dc "A-Za-z0-9-_" </dev/urandom | head -c 20 ; echo'
alias kraken='LC_CTYPE=C open -na GitKraken --args -p "$(git rev-parse --show-toplevel)"'
alias wifion='networksetup -setnetworkserviceenabled Wi-Fi on'
@yspreen
yspreen / install_python3.sh
Last active July 13, 2018 09:45
Install Python 3 on Pi
#!/bin/bash
sudo apt-get install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev -y
wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz
tar xf Python-3.6.5.tar.xz
cd Python-3.6.5
./configure
make -j4
sudo make install
@yspreen
yspreen / mac_change.bat
Last active July 19, 2018 20:30 — forked from iJos/mac_change.bat
[BAT] Randomly change the Mac Address on Windows
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
SETLOCAL ENABLEEXTENSIONS
if "%~1"=="" goto blank
set /a x=0
::Generate and implement a random MAC address
FOR /F "tokens=1" %%a IN ('wmic nic where physicaladapter^=true get deviceid ^| findstr [0-9]') DO (