Skip to content

Instantly share code, notes, and snippets.

View AKST's full-sized avatar

Angus AKST

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Copyright 2021 Angus Thomsen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
@AKST
AKST / getgot.script
Created June 6, 2021 00:04
Lyrics of death grips get got roughly to the millisecond
# intro
16.000: [lyric] get
16.500: [lyric] get
17.000: [lyric] get
17.500: [lyric] get
18.000: [lyric] got
18.500: [lyric] got
19.000: [lyric] got
19.500: [lyric] got
@AKST
AKST / akst.obj
Last active November 3, 2020 12:44
# Blender v2.90.1 OBJ File: ''
# www.blender.org
mtllib akst.mtl
o Curve
v 1.000000 -0.088656 -3.474279
v 1.000000 -0.064552 -3.464055
v 1.000000 -0.039982 -3.454721
v 1.000000 -0.014946 -3.446275
v 1.000000 0.010554 -3.438719
v 1.000000 0.036521 -3.432051
class Controller {
@mobx.observable.ref count = 0;
@action
increment() {
this.count += 1;
}
}
// exposing a controller for a singleton component
def example_function(x, y, z):
return (x + y) * z
print(example_function(1, 2, 3)) # prints 9
print(example_function(1, 2, z=3)) # prints 9
print(example_function(x=1, y=2, z=3)) # prints 9
# will break your program, because positional arguments are
@AKST
AKST / refresh_os_appearance.fish
Last active June 24, 2019 12:40
I wrote a some fish shell that updates the operating systems appearance to use light mode during the day and dark mode during the evening.
#!/usr/bin/env fish
begin
function current_appearance
set output (osascript -l JavaScript -e "
Application('System Events').appearancePreferences.darkMode()
")
if test "$output" = "true"
echo "dark"
else
@AKST
AKST / deepcopy.js
Last active January 29, 2018 12:29
A function for deep copying objects, that makes the assumption that the constructors of these objects are stateless.
function deepcopy (value) {
// if it's anything other than an object
// than let immediately return it.
switch (typeof value) {
case 'object': break;
default: return value;
}
// If it's a null let also return that.
if (value === null) return value;
@AKST
AKST / tree-table.scm
Created December 26, 2017 06:20
SICP Exercise 3.26, nth depth table as a tree
(define (make-table . args)
;; there is an optional parameter for a function
;; which can check the equality of keys
(define (default-comp l r)
(cond ((eq? l r) 'eq)
((> l r) 'gt)
((< l r) 'lt)))
(define compare-key
(if (null? args)
@AKST
AKST / 2d-table.scm
Created December 26, 2017 01:59
A two dimensional table
(define (make-table)
;; assoc helper
(define (assoc key records)
(cond ((null? records) #f)
((equal? key (caar records)) (car records))
(else (assoc key (cdr records)))))
;; local-table will be internal state
;; for the procedural object
(let ((local-table (list '*table*)))