Skip to content

Instantly share code, notes, and snippets.

View haylinmoore's full-sized avatar
🦖
dns

haylin haylinmoore

🦖
dns
View GitHub Profile
<body>
<header>
<h1>Hola Mundo!</h1>
</header>
<hr>
<main>
<p>
Welcome to my tiny spot on the internet. This is just a small little test site I threw together to show my friend Codepen.
</p>
const express = require("express");
const execSync = require("child_process").execSync;
const fs = require("fs");
const app = express();
const port = 6969;
function padIP(ip) {
let inflate = [];
ip.split(":").forEach((x) => (x != "" ? inflate.push("0".repeat(4 - x.length) + x) : inflate.push("")));
let zeroes = 0;
@haylinmoore
haylinmoore / grid.js
Created September 6, 2020 01:55
A very simple class for placing ascii art on a grid
class Grid {
constructor(width, height) {
this.width = width;
this.height = height;
this.map = [];
for (let y = 0; y < height; y++) {
this.map[y] = []; // set up inner array
#!/bin/bash
METADATA=$(playerctl metadata --format "{{ title }} - {{ artist }}" 2>&1)
if [ "$METADATA" = "No player could handle this command" ]; then
echo ""
else # Can be configured to output differently when player is paused
polybar-msg -p "$(pgrep -f "polybar top")" hook spotify-play-pause 1 >/dev/null
echo "$METADATA"
fi
#pragma config(Sensor, in4, centerLineFollower, sensorLineFollower)
#pragma config(Sensor, dgtl1, rightEncoder, sensorQuadEncoder)
#pragma config(Sensor, dgtl3, leftEncoder, sensorQuadEncoder)
#pragma config(Sensor, in3, gyroSensor, sensorVirtualCompass)
#pragma config(Sensor, dgtl11, touchSensor, sensorTouch)
#pragma config(Sensor, dgtl8, sonarSensor, sensorSONAR_cm)
#pragma config(Motor, port2, rightMotor, tmotorServoContinuousRotation, openLoop, reversed)
#pragma config(Motor, port3, leftMotor, tmotorServoContinuousRotation, openLoop)

Keybase proof

I hereby claim:

  • I am hamptonmoore on github.
  • I am herohamp (https://keybase.io/herohamp) on keybase.
  • I have a public key whose fingerprint is D234 1B58 4752 4E03 03B1 EDC1 BF8B 5E53 E143 7F71

To claim this, I am signing this object:

#!/usr/bin/env sh
expr $(cat /sys/class/backlight/intel_backlight/brightness) + "$1" > /sys/class/backlight/intel_backlight/brightness
@haylinmoore
haylinmoore / maimpick
Created February 16, 2020 20:51
LARBS maimpick but with imgur as an destination
#!/usr/bin/env sh
# This is bound to Shift+PrintScreen by default, requires maim. It lets you
# choose the kind of screenshot to take, including copying the image or even
# highlighting an area to copy. scrotcucks on suicidewatch right now.
PHOTOPATH=~/Pictures/$(date '+%y%m%d-%H%M-%S').png
upload(){
curl -s -H "Authorization: Client-ID c9a6efb3d7932fd" -H "Expect: " -F "image=$1" https://api.imgur.com/3/image.xml | sed -n 's:.*<link>\(.*\)</link>.*:\1:p' | xclip -selection clipboard
#!/usr/bin/env sh
AVERAGE=$(ls /sys/class/power_supply | grep "BAT" | xargs -I % cat /sys/class/power_supply/%/capacity | awk '{ total += $1; count++ } END { printf "%.0f", total/count }')
STATUSES=$(ls /sys/class/power_supply | grep "BAT" | xargs -I % cat /sys/class/power_supply/%/status | sed -e "s/,//;s/Discharging/🔋/;s/Not charging//;s/Charging/🔌/;s/Unknown//;s/Full//;s/ 0*/ /g;s/ :/ /g" | tr -d '\n')
echo "$AVERAGE% $STATUSES"