Skip to content

Instantly share code, notes, and snippets.

@servercharlie
servercharlie / sc-tools.bat
Last active April 3, 2017 02:52
sc-tools
@echo off
@title "SC-Tools Installer"
echo Administrative permissions required. Detecting permissions...
net session >nul 2>&1
if %errorLevel% == 0 (
echo Failure: Current permissions not enough, please run as admin.
pause >nul
exit
) else (
echo Success: Administrative permissions confirmed.
@servercharlie
servercharlie / 32or64bit.bat
Created April 2, 2017 14:01
32or64bit.bat - curl test
@echo OFF
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set OS=32BIT || set OS=64BIT
If %OS% == 32BIT (
Echo "This is a 32bit operating system"
)
If %OS% == 64BIT (
Echo "This is a 32bit operating system"
)
@servercharlie
servercharlie / contextualpromisechain.js
Last active March 30, 2017 18:51
Contextual Promise Chain JS
// allows you to use contexts within promise chains.
// works best w/ KeyStore where you use your context as your keystore context name / id.
// KeyStore.js | a globally reusable value / reference storage
// https://gist.github.com/servercharlie/f5b104ceb0bb559e6281b040e6d875e4
// use your own contexts, or use uuid's (like in the provided example)
// SimpleUUID.js | an expertly refined generator & validator for UUIDv4.
// https://gist.github.com/servercharlie/70638dd74bec7b52223ef9794b47f83c
@servercharlie
servercharlie / simpleuuid.js
Created March 30, 2017 17:44
SimpleUUID JS
// https://gist.github.com/jed/982883
// https://github.com/chriso/validator.js/blob/master/validator.js#L774-L787
// https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Proxy
var uuidv4 = new Proxy(function(_removeDash){
function b(a){return a?(a^Math.random()*16>>a/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,b)}
return _removeDash ? b().replace(/-/g, '') : b();
}, {
get(target, name) {
return {
@servercharlie
servercharlie / simpleshell.js
Last active March 30, 2017 16:15
SimpleShell JS
// SIMPLE SHELL JS
// Simple fucking module that simplifies all the bullshit
// from NodeJS shell command execution.
// optional stdout, stderr & close callbacks.
// very minimal code.
// efficiently designed for use with promises.
// best use cases:
@servercharlie
servercharlie / keystore.js
Last active March 30, 2017 15:18
KeyStore JS
// alternative for globally reusable variables
// supports contexts
// can store all javascript types
// to create object-based unique contexts,
// we advise assigning a uuidv4 to that object
// then using that uuid as the context for that object.
// best use cases:
#!/bin/bash
# yes
@servercharlie
servercharlie / gist:62ff819870d17f350c09ebe573b55388
Created March 11, 2017 06:44 — forked from listochkin/gist:1200393
Algorithm for Area of a closed polygon.