Skip to content

Instantly share code, notes, and snippets.

:shipit:
hmm

Neal Fennimore nealfennimore

:shipit:
hmm
Block or report user

Report or block nealfennimore

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View toggle_vpn
#!/usr/bin/env bash
IFS=$'\n'
VPNS=($(nmcli con | grep vpn))
UUID_REGEX="^.*\(\w\{8\}.*\w\{12\}\).*$"
is_active_vpn() {
row=$(nmcli con | grep $1 | sed 's/\s*$//g' ) # Trim whitespace so we can test ending column
if [[ $row =~ ^.*--$ ]]; then
echo -n 0
@nealfennimore
nealfennimore / unmount-busy-drive
Last active Oct 6, 2019
Unmounting busy drive
View unmount-busy-drive
# Check to see what processes are using drive
fuser -vm /dropbox
sudo umount /dropbox
View RGBtoRGBA.js
// https://stackoverflow.com/questions/6672374/convert-rgb-to-rgba-over-white
function RGBtoRGBA(r, g, b){
if((g == null) && (typeof r === 'string')){
var hex = r.replace(/^\s*#|\s*$/g, '');
if(hex.length === 3){
hex = hex.replace(/(.)/g, '$1$1');
}
r = parseInt(hex.substr(0, 2), 16);
g = parseInt(hex.substr(2, 2), 16);
b = parseInt(hex.substr(4, 2), 16);
View iota-full-node.sh
function addNeighbor() {
payload=$(jq -n --arg uris "$1" '{"command":"addNeighbors", "uris":[ $uris ]}')
curl http://localhost:14265 -H "X-IOTA-API-VERSION: 1.4" -d "$payload" | jq
}
function removeNeighbor() {
payload=$(jq -n --arg uris "$1" '{"command":"removeNeighbors", "uris":[ $uris ]}')
curl http://localhost:14265 -H "X-IOTA-API-VERSION: 1.4" -d "$payload" | jq
}
@nealfennimore
nealfennimore / moment.js
Created Sep 27, 2017
Mock Moment with Jest so it's always utc for tests
View moment.js
import moment from 'moment';
const _constructor = ( ...args ) => moment.utc( ...args );
const clone = Object.assign( _constructor, moment );
export default clone;
@nealfennimore
nealfennimore / git-branch.sh
Created May 6, 2017
Terminal git branch state
View git-branch.sh
# https://gist.github.com/chrisnolet/d07a55580337cfe7d5388b1d3c4960cc
function git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* (*\([^)]*\))*/\1/'
}
function markup_git_branch {
if [[ -n $@ ]]; then
if [[ -z $(git status --porcelain 2> /dev/null | tail -n1) ]]; then
echo -e " \001\033[32m\002($@)\001\033[0m\002"
@nealfennimore
nealfennimore / visually-hidden.css
Last active Apr 21, 2017
Accessible Hiding of DOM Elements
View visually-hidden.css
/* http://a11yproject.com/posts/how-to-hide-content/ */
.visually-hidden {
position: absolute !important;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
padding:0 !important;
border:0 !important;
height: 1px !important;
width: 1px !important;
@nealfennimore
nealfennimore / smb.conf
Last active Mar 28, 2017
Working SAMBA config for Ubuntu (Server)
View smb.conf
[global]
workgroup = WORKGROUP
netbios name = FROOBUN
security = user
encrypt passwords = yes
interfaces = lo wlp5s0 #Uses loopback and wireless interface names
[froobun]
comment = Home
path = /home/neal
valid users = neal
@nealfennimore
nealfennimore / .sass-lint.yml
Last active Mar 30, 2017
SASS/SCSS linter yaml
View .sass-lint.yml
# sass-lint config generated by make-sass-lint-config v0.1.2
#
# Converted from https://github.com/airbnb/css/blob/master/.scss-lint.yml
files:
include: '**/*.s+(a|c)ss'
options:
formatter: stylish
merge-default-rules: false
rules:
@nealfennimore
nealfennimore / palidrome.js
Last active Mar 8, 2017
Palindrome Permutation
View palidrome.js
function palindrome(str){
const unique = [...new Set(str.split(''))];
const counts = unique.map( char =>{
return str.match( new RegExp(char, 'g') ).length
});
let odd = 0,
even = 0;
You can’t perform that action at this time.