Skip to content

Instantly share code, notes, and snippets.

Avatar
🔧

Abe Flansburg aflansburg

🔧
View GitHub Profile
@aflansburg
aflansburg / Password.js
Last active Jul 1, 2020
Very basic JS password strength test
View Password.js
class Password {
constructor(password){
this.password = password;
this.getPassword = () => password
this.STRENGTH_CRITERIA = {
length: 8,
alpha_numeric_count: 8,
spec_char_count: 1,
@aflansburg
aflansburg / cyberpunk_vaporwave.itermcolors
Created Jan 13, 2020
Vaporwave / Cyberpunk 2077 iTerm Color Theme/Scheme
View cyberpunk_vaporwave.itermcolors
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.13725490868091583</real>
@aflansburg
aflansburg / chinaFriendlyCaptcha.js
Last active Sep 15, 2020
Creating a China friendly captcha w/ Jquery & Rails view
View chinaFriendlyCaptcha.js
function getCnNumber(x){
if (x > 10 && x <= 20){
const ch = '零一二三四五六七八九十'.split('').map((c, i) => x === i && c).find(s => s);
return '十' + ch;
}
else
return '零一二三四五六七八九十'.split('').map((c, i) => x === i && c).find(s => s);
}
function solveHuman(ans){
@aflansburg
aflansburg / user-actions.rb
Last active Sep 9, 2020
simple ruby console app example - user auth
View user-actions.rb
# simple user class
class User
def initialize(user_name, password)
@user_name = user_name
@password = password
end
attr_accessor :user_name
attr_accessor :password
end
@aflansburg
aflansburg / dir-crawl-copy.py
Created Jun 21, 2018
Traverse (walk) a directory tree, match filenames provided in csv, copy matched file to another directory
View dir-crawl-copy.py
import os
import shutil
import csv
# to store filenames provided in csv
filenames = []
# read single column csv of filenames (no extension)
csv_path = 'parts.csv'
with open(csv_path, newline='') as csvfile:
@aflansburg
aflansburg / cascadeDelay.js
Created May 18, 2018
Cascading Async/Await Delay against an Array - Node.js
View cascadeDelay.js
// slight modification and re-application of daliborgogic/delay.js
const timeout = ms => new Promise(res => setTimeout(res, ms));
// index is the index of an array member
async function throttle(index){
console.log(`Index ${index} will fire after ${1500*index}ms`);
return timeout(index*1500);
}
// let's say you have an async operation that makes requests to certain endpoints
@aflansburg
aflansburg / scriptureme.coffee
Last active Mar 22, 2018
Bible Verse Quoting for Hubot - scriptureme
View scriptureme.coffee
# Description:
# Hubot returns scripture using bibleverses package
#
# Dependencies:
# bibleverses
#
# Configuration:
# `npm install bibleverses --save`
#
# Commands:
@aflansburg
aflansburg / parrot.coffee
Created Mar 15, 2018
Hubot script to parrot what you desire in the specified room
View parrot.coffee
# Description:
# RCBOT Parrots what you said to the specified room
#
# Dependencies:
# None
#
# Commands:
# rcbot say in #devops "Something blah blah blah"
#
# Author:
@aflansburg
aflansburg / timestamp_sheet.js
Created Dec 7, 2017
Add a timestamp to a cell in Google Sheets (Gsheets)
View timestamp_sheet.js
function addTimestamp(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var cell = sheet.getRange('A1');
var d = new Date();
d.setHours(d.getHours());
var user = Session.getActiveUser().getUserLoginId();
user = String(user);
// cosmetic: this just removes the email domain from the user info
user = user.replace('@gmail.com', '');
@aflansburg
aflansburg / removeEmptyRows.js
Created Dec 7, 2017
Remove empty rows from Google Sheets (Gsheets)
View removeEmptyRows.js
function onInstall(e){
onOpen(e);
}
function onOpen(e){
var menu = SpreadsheetApp.getUi().createAddonMenu();
menu.addItem('Remove Empty Rows', 'removeEmptyRows');
menu.addToUi();
}
You can’t perform that action at this time.