Skip to content

Instantly share code, notes, and snippets.

View nyteshade's full-sized avatar

Brielle Harrison nyteshade

View GitHub Profile
@nyteshade
nyteshade / functions.sh
Last active July 6, 2017 02:12
File (de)encryption using openssl
# Encryption and decryption BASH functions using openssl
function decrypt() {
# The first param doesn't contain .enc, write output plus .decrypted if no 2nd
if [ "${1/.enc/}" = "${1}" -a -e "${1}" ]; then
openssl enc -d -aes-256-cbc -in "${1}" -out "${2:-${1}.decrypted}"
# The first param contains .enc, write the output without if no 2nd param
elif [ "${1/.enc/}" != "${1}" -a -e "${1}" ]; then
openssl enc -d -aes-256-cbc -in "${1}" -out "${2:-${1/.enc/}}"
@nyteshade
nyteshade / Code.js
Last active May 4, 2017 22:51
Simple class in ES5 parlance that tracks code and its history of changes
// ES5
/**
* The Code "class" defines an object that represents a source code with
* a history of changes. Whenever its source property is assigned, the
* new value is pushed onto a stack of code. Whenever its source property
* is read, the latest iteration of the code is returned as a string.
*
* @method Code
*
@nyteshade
nyteshade / getcip.c
Last active April 12, 2017 01:23
niceps1
#include <sys/types.h>
#include <arpa/inet.h>
#include <ifaddrs.h>
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
@nyteshade
nyteshade / html.html
Created April 6, 2017 00:12
Copland Progress Bars
<div class="progress p0">
<div class="bar">
<div class="slice slice1"></div>
<div class="slice slice2"></div>
<div class="slice sliceN"></div>
<div class="slice slice3"></div>
<div class="slice slice4"></div>
<div class="slice slice5"></div>
</div>
<div class="track">
@nyteshade
nyteshade / multiline.js
Created December 8, 2016 21:29
Kill whitespace before and after template strings
/**
* A small helper for multiline template strings that allows you to
* not worry about new lines and indentations within your code from
* breaking up the format of the string.
*
* @param {Array} strings an array of Strings from the template, broken up by
* where the substitions are to be inserted.
* @param {Array} values an array of values to be inserted after each string
* of a matching index.
* @return {String} a template String without any prefixed or postfixed tabs
@nyteshade
nyteshade / packme.js
Last active April 30, 2018 04:14
Run webpack on the fly
#!/usr/bin/env node --harmony
// Fetch the Path, File System and Child Process modules
var Path = require('path');
var FS = require('fs');
var CP = require('child_process');
/**
* The actual webpack config is stored within a function and then
* extracted as a string as this preserves the regular expression
@nyteshade
nyteshade / ChoiceSet.js
Created September 25, 2016 09:19
Weighted Random
/**
* ChoiceSet is a weighted random solution that allows the each of the
* items that are being chosen to have simply a name or full suite of
* values other than their weights and names.
*
* Once the items have been setup with a name and weight, the system works
* by creating a one to one array. Each item in the new array is a sum of
* all the subsequent and current weights. The final weight, being the
* maximum total weight, is also stored.
*
@nyteshade
nyteshade / atom.stylesheet.less
Last active August 2, 2019 08:44
CRT Styling and Feel for the Atom Text Editor
atom-text-editor {
// CRT Styling taken from https://codepen.io/lbebber/pen/XJRdrV
// Begin CRT Styling
background: #121010;
position: relative;
overflow: hidden;
// flicker
&::after {
content: " ";
@nyteshade
nyteshade / fork forced sync
Created July 18, 2016 20:10 — forked from glennblock/fork forced sync
Force your forked repo to be the same as upstream.
git fetch upstream
git reset --hard upstream/master
@nyteshade
nyteshade / side_by_side.css
Created January 27, 2015 06:36
How to do side by side elements, with vertical alignment, without floats
div.left-right {
box-sizing: border-box;
display: inline-block;
font-size: 0;
position: relative;
white-space: nowrap;
width: 100%;
}
div.left-right div.left,