This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo osascript -e 'repeat 2 times | |
repeat 16 times | |
tell application "System Events" | |
key code 107 | |
delay 0.1 | |
end | |
end repeat | |
delay 0.5 | |
repeat 16 times | |
tell application "System Events" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Not my original work -- all thanks to the Stackoverflow Gods | |
#!/bin/bash | |
# remove stopped containers | |
docker rm $(docker ps -a -q) | |
# remove dangling images | |
docker rmi $(docker images -q --filter "dangling=true") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Great for when Ubuntu Server decides to lock you out because /boot is full of old kernels | |
# Credit: Somebody on Stackoverflow | |
#!/usr/bin/env python2 | |
# See: http://askubuntu.com/questions/345588/what-is-the-safest-way-to-clean-up-boot-partition#answer-430944 | |
import re | |
import sys | |
import subprocess |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import inspect, sys | |
from django.contrib import admin | |
def register_all_models(module): | |
for name, obj in inspect.getmembers(sys.modules[module]): | |
if inspect.isclass(obj) and obj.__name__ is not "User": | |
if hasattr(obj, "_meta") and not obj._meta.abstract: | |
admin.site.register(obj) | |
register_all_models("<appname_here>.models") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.cookie.split(";").map(cookie => {var _csrf = cookie.indexOf("csrftoken")===0?cookie.split("=")[1]:0; if(_csrf)return _csrf })[0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from 'react' | |
class ${NAME} extends Component { | |
render() { | |
return ( | |
<div>${NAME}</div> | |
) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Sends command 'ATI' to modem #3 | |
# Get a list of modems by running `mmcli -L` | |
# Timeout is (probably) 2 seconds | |
# Also see https://www.freedesktop.org/software/ModemManager/api/latest/gdbus-org.freedesktop.ModemManager1.Modem.html#gdbus-method-org-freedesktop-ModemManager1-Modem.Command | |
dbus-send --system --dest=org.freedesktop.ModemManager1 --print-reply /org/freedesktop/ModemManager1/Modem/3 org.freedesktop.ModemManager1.Modem.Command string:'ATI' uint32:2000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
interface IProps { | |
// TODO | |
} | |
class ${NAME} extends Component<IProps> { | |
public render(): React.ReactNode { | |
return ( | |
<div>${NAME}</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"github.com/godbus/dbus" | |
"go.uber.org/zap" | |
) | |
const hotspotConnectionUUID = "45b366f6-e56c-4b46-8699-e5fb62ce292e" | |
const ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
red_on() { | |
echo 255 > /sys/class/leds/pca963x:red/brightness | |
} | |
red_off() { | |
echo 0 > /sys/class/leds/pca963x:red/brightness | |
} | |
blue_on() { | |
echo 255 > /sys/class/leds/pca963x:blue/brightness |
OlderNewer