Skip to content

Instantly share code, notes, and snippets.

@steelbrain
steelbrain / generate-types.ts
Created June 22, 2023 14:22
Generate static types from a Typescript type for use in sibling projects
import childProcess from 'child_process'
import fs from 'fs'
import path from 'path'
import ts from 'typescript'
import { fileURLToPath } from 'url'
const PATH_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
const PATH_TYPES_SOURCE = path.join(PATH_ROOT, 'src', 'types.ts')
const PATH_TYPES_OUTPUT = path.join(PATH_ROOT, 'src', 'types.output.d.ts')
@steelbrain
steelbrain / README.md
Last active August 14, 2020 05:07
OLED Brightness Daemon

OLED Brightness Daemon

I'm using this for my Razer Blade 17 Pro 2020 to keep the brightness slider in Ubuntu GNOME up to date with the actual brightness of the display.

It's not pretty but it works. Remember to add this to your startup (gnome-session-properties).

License

Licensed under MIT. Use however.

@steelbrain
steelbrain / index.js
Created August 24, 2018 13:10
iTerm2 Color Profile Printer
// Usage: node index.js
// Requires: npm install rgb-hex xml2json
// Requires color profile to be placed as Profile.itermcolors
// in same directory
const fs = require('fs')
const path = require('path')
const rgbHex = require('rgb-hex')
const { toJson } = require('xml2json')
@steelbrain
steelbrain / git-post-pr.sh
Created August 16, 2017 20:55
git-post-pr
#!/bin/bash
# Usage:
# git-post-pr
# Description:
# Deletes local branch (doesn't force so you won't lose local if not pushed remotely)
# Fetches remote so local remote branch is deleted
# Switches to master
CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"