Skip to content

Instantly share code, notes, and snippets.

Avatar

notanimposter

View GitHub Profile
@notanimposter
notanimposter / Bluetooth Thing
Last active Jun 30, 2020
Stop bluetooth from turning on everytime the computer wakes up
View Bluetooth Thing
# Put the .service files in /etc/systemd/system/
# and the btstate file in /usr/local/bin/
# Then run these commands.
sudo chmod +x /usr/local/bin/btstate
sudo systemctl enable btstate.service
sudo systemctl enable btstate-startonwake.service
# You might have to change "hci0" in the /usr/local/bin/btstate file to
# whatever your bluetooth device is called. You can find it by running
@notanimposter
notanimposter / prettyprint.lua
Created Jun 15, 2020
A function for displaying tables... prettily
View prettyprint.lua
function utf8_length(str)
return select(2, str:gsub('[^\128-\193]', ''))
end
function box_reverse(str)
local map = {
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
@notanimposter
notanimposter / irc.vala
Created Jun 15, 2020
A work-in-progress IRC/Twitch chat library in Vala
View irc.vala
namespace TwitchChat {
public class Chat {
public string name;
public string streamer {
owned get {
return name.substring(1);
}
}
public string[] users;
@notanimposter
notanimposter / make_second_plank.sh
Created Mar 13, 2020
make a second plank for your second monitor
View make_second_plank.sh
#!/bin/bash
plank -n dock2 &
kill $!
printf "Monitor: "
read monitor
echo "Using $monitor as monitor"
gsettings reset-recursively net.launchpad.plank.dock.settings:/net/launchpad/plank/docks/dock2/
for key in $(gsettings list-keys net.launchpad.plank.dock.settings:/net/launchpad/plank/docks/dock1/); do
val=$(gsettings get net.launchpad.plank.dock.settings:/net/launchpad/plank/docks/dock1/ $key)
@notanimposter
notanimposter / nowplaying
Created Mar 8, 2020
A now playing script for MPRIS and OBS (to be run as a systemd user service). Change the file path, music player name, etc. to whatever works for you
View nowplaying
#!/usr/bin/env python3
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
import gi
gi.require_version('Playerctl', '2.0')
from gi.repository import Playerctl, GLib
@notanimposter
notanimposter / cubeviewer.cs
Created Feb 13, 2016
3D rendering in Space Engineers (depends on drawlib.cs)
View cubeviewer.cs
public class CubeViewer {
private static int[][] cubeSides = new int[][] {
SEFix.arr(
1, 1,-1,
1, 1, 1,
-1, 1, 1,
-1, 1,-1
), SEFix.arr(
-1, 1,-1,
-1, 1, 1,
@notanimposter
notanimposter / drawlib.cs
Last active Oct 26, 2020
Drawing library for SE v2.4
View drawlib.cs
public class SEFix {
public static T[] arr<T>(params T[] arg) {
return arg; //becuse SE is stupid
}
}
public class ColorUtils {
private static double oo64 = 1.0/64.0;
private static double[][] map = new double[][] {
new double[] { 0*oo64, 48*oo64, 12*oo64, 60*oo64, 3*oo64, 51*oo64, 15*oo64, 63*oo64},
new double[] {32*oo64, 16*oo64, 44*oo64, 28*oo64, 35*oo64, 19*oo64, 47*oo64, 31*oo64},
@notanimposter
notanimposter / drawlib.cs
Last active Jan 12, 2016
SE drawing library (version 2)
View drawlib.cs
public class ColorUtils {
private static double oo64 = 1.0/64.0;
private static double[][] map = new double[][] {
new double[] { 0*oo64, 48*oo64, 12*oo64, 60*oo64, 3*oo64, 51*oo64, 15*oo64, 63*oo64},
new double[] {32*oo64, 16*oo64, 44*oo64, 28*oo64, 35*oo64, 19*oo64, 47*oo64, 31*oo64},
new double[] { 8*oo64, 56*oo64, 4*oo64, 52*oo64, 11*oo64, 59*oo64, 7*oo64, 55*oo64},
new double[] {40*oo64, 24*oo64, 36*oo64, 20*oo64, 43*oo64, 27*oo64, 39*oo64, 23*oo64},
new double[] { 2*oo64, 50*oo64, 14*oo64, 62*oo64, 1*oo64, 49*oo64, 13*oo64, 61*oo64},
new double[] {34*oo64, 18*oo64, 46*oo64, 30*oo64, 33*oo64, 17*oo64, 45*oo64, 29*oo64},
new double[] {10*oo64, 58*oo64, 6*oo64, 54*oo64, 9*oo64, 57*oo64, 5*oo64, 53*oo64},
You can’t perform that action at this time.