Skip to content

Instantly share code, notes, and snippets.

View sclark39's full-sized avatar

Skyler Clark sclark39

View GitHub Profile
@sclark39
sclark39 / analog_shulker.command_block
Last active June 5, 2017 14:13
Minecraft Color Coded Signal Strength Shulker Boxes
/blockdata ~0 ~1 ~0 {Items:[
{id:brown_shulker_box,Slot:0,Count:1,tag:{display:{Name:"Signal Strength 1"},
BlockEntityTag:{Items:[
{Slot:4,id:redstone_block,Count:21b},
{Slot:13,id:redstone_block,Count:21b},
{Slot:22,id:redstone_block,Count:21b}
]}}},
{id:red_shulker_box,Slot:1,Count:1,tag:{display:{Name:"Signal Strength 2"},
BlockEntityTag:{Items:[
{Slot:3,id:redstone_block,Count:21b},
@sclark39
sclark39 / fishingrod.command_block
Created June 5, 2017 14:12
Creates an auto-refilling chest with a enchanted fishing rod
/blockdata ~0 ~1 ~0 {Items:[
{id:fishing_rod,Slot:0,Count:1,tag:{ench:[{id:34,lvl:6},{id:61,lvl:3},{id:62,lvl:5}]}}
]}
@sclark39
sclark39 / gist:7c4eaeabd6fc453c90c3b2eaed7126dc
Last active June 5, 2017 18:18
Redstone Superflat World
Superflat Preset:
3;1*minecraft:bedrock,50*minecraft:stained_hardened_clay:9,1*minecraft:concrete:13;1;
/gamerule commandBlockOutput false
/gamerule doMobSpawning false
/gamerule doWeatherCycle false
/gamerule doDaylightCycle false
/time set 4284
@sclark39
sclark39 / co-scheduler.js
Created September 25, 2017 14:31
This scheduler allows you to run multiple co "threads" that can yield and do async actions without being interrupted until explicitly declared.
var co = require('co')
var scheduler =
{
queue : []
}
// Requests control from scheduler
scheduler.promote = function()
{
@sclark39
sclark39 / hotload.js
Created October 7, 2017 17:39
Endless loop, re-runs code every time file change is detected.
var co = require('co')
var Promise = require("bluebird")
var chokidar = require('chokidar')
var hotloadFile = 'hotload.js'
var watcher = chokidar.watch( hotloadFile )
function waitForHotload()
{
return new Promise( (fulfill, reject) => watcher.once( 'change', fulfill ) )
@sclark39
sclark39 / InstagramIdConvert.js
Last active April 17, 2025 14:07
Convert from Instagram Shortcode to Id and Back using big-integer
var bigint = require( 'big-integer' )
var lower = 'abcdefghijklmnopqrstuvwxyz';
var upper = lower.toUpperCase();
var numbers = '0123456789'
var ig_alphabet = upper + lower + numbers + '-_'
var bigint_alphabet = numbers + lower
function toShortcode( longid )
@sclark39
sclark39 / day4.js
Last active December 4, 2017 23:04
Solution to the Advent of Code 2017 Day 4
// var passphrases = input.split('\n')
function countValid( passphrases, allowAnagrams )
{
return passphrases.reduce( (s,passphrase) => {
var passwords = passphrase.split(' ')
passwords = allowAnagrams ? passwords : passwords.map( a => ( a.split('').sort().join('') ) )
return s + passwords.reduce( ( s,n,i,a ) => s && a.indexOf(n) == i )
}, 0 )
}
@sclark39
sclark39 / day3.js
Last active December 7, 2017 09:57
Advent of code 2017 Day 3 part 2
// Advent of Code 2017 - Day 3 Part 2
// by @sclark39
var add = ( a, b ) => ([ a[0] + b[0], a[1] + b[1] ])
var turn = (a) => ( a[0] == 0 ? [ -a[1], 0 ] : [ 0, a[0] ] )
function buildSpiral(input)
{
var spiral = [ [1] ]
spiral.get = ( c ) => ( spiral[c[0]] && spiral[c[0]][c[1]] )
@sclark39
sclark39 / 123Fortnite.ahk
Last active June 23, 2018 15:45
123 lines to becoming a Fortnite god - Custom lastinv bind, hold to toggle crouch, and confirm build on mouse up
HotKey, IfWinActive, Fortnite
; Fortnite Binds
Fortnite.RegisterKey( "1", "MeleeSlotKey" )
Fortnite.RegisterKey( "2", "WeaponSlotKey" )
Fortnite.RegisterKey( "3", "WeaponSlotKey" )
Fortnite.RegisterKey( "4", "WeaponSlotKey" )
Fortnite.RegisterKey( "z", "WeaponSlotKey" )
Fortnite.RegisterKey( "x", "WeaponSlotKey" )
Fortnite.RegisterKey( "q", "BuildKey" )
function Foo( Name )
return function( Table )
; Construct
return something
end
end
;Called with:
Foo 'Bar' {}