Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeff Lindsay progrium

View GitHub Profile
@progrium
progrium / devrc.sh
Created May 28, 2020
zsh hook to automatically source/"unsource" directories with .devrc
View devrc.sh
autoload -U add-zsh-hook
load-devrc() {
if [[ -f .devrc && -r .devrc ]]; then
source .devrc
else
if typeset -f devrc-unset > /dev/null; then
devrc-unset
unset -f devrc-unset
fi
fi
View gist:12a2941edb41a4610be80d7248ac0dc5
sudo softwareupdate --fetch-full-installer
/Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/startosinstall \
--eraseinstall --agreetolicense --nointeraction
View gist:edd0f8bac978d9fb37c470459e291f89
package main
import (
"fmt"
"reflect"
)
type MyInterface interface {
Foo() string
}
View NowPlayingStatus.js
#!/usr/bin/env osascript -l JavaScript
ObjC.import("Cocoa");
function run(argv) {
var app = $.NSApplication.sharedApplication;
var statusBarItem = $.NSStatusBar.systemStatusBar.statusItemWithLength($.NSVariableStatusItemLength);
var track = Application('Spotify').currentTrack
ObjC.registerSubclass({
name: "ProgramDelegate",
@progrium
progrium / fbpost
Last active Aug 17, 2018
Facebook no longer allows news feed posts to be added programmatically via API. But we can still post them programmatically... https://medium.com/@progrium/the-only-way-you-can-automate-facebook-posts-now-bd3a40fd1c4b
View fbpost
#!/usr/bin/env node
// Usage:
// Login manually, saving your authenticated session in "data":
// $ ./fbpost --login
//
// Now you can post whatever you want via argument:
// $ ./fbpost "Hello world, this is a post!"
//
(async() => {
const puppeteer = require('puppeteer');
@progrium
progrium / example.js
Last active Jul 14, 2018
Example throw-away DSL for generating TypeScript
View example.js
var Generator = require("./tsgen")
ts = new Generator()
ts.decl("import", "electron", "from", ts.str("electron"))
ts.decl("import", "qrpc", "from", ts.str("qrpc"))
ts.commentBlock("Here is a function")
ts.func("register", [ts.var("api", "qrpc.API")], null, (ts) => {
ts.call("api.handle", ts.str("echo"), ts.lambda(ts.var("r", "qrpc.Responder"), ts.var("c", "qrpc.Call"), null, (ts) => {
ts.call("r.return", ts.inline(ts.call("c.decode")))
}))
View gist:8f6daad638b4fe06bc959d34eff2fa2d
Process: Descript [12470]
Path: /Applications/Descript.app/Contents/MacOS/Descript
Identifier: com.descript.Descript
Version: 1.4.2 (1806260931)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Descript [12470]
User ID: 501
Date/Time: 2018-06-28 19:42:29.774 -0500
View FollowSceneCamera.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[ExecuteInEditMode]
public class FollowSceneCamera : MonoBehaviour {
private Vector3 lastPosition;
private Quaternion lastRotation;
View gist:824849a0edd0beb206956d00da744f0f
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ElevatorDoors : MonoBehaviour {
public GameObject doorLeft;
public GameObject doorRight;
public float speed = 20f;
public GameObject elevator;
View gist:4a725372954cfa0ee39ae2aad502ae5f
// magical github automation
//
// add hooks similar to below based on:
// https://developer.github.com/v3/activity/events/types/
//
// use github object according to docs:
// http://mikedeboer.github.io/node-github/
const Promise = require("bluebird");