Skip to content

Instantly share code, notes, and snippets.

View benyanke's full-sized avatar

Ben Yanke benyanke

View GitHub Profile
// SpiceWorks ticket autofill
// Autofills the ticket based on get variables in the URL of the ticket.
// This file is at: https://gist.github.com/benyanke/994ce01b938fd2d1eb9ec1a0ecb79b35
//
// Also usable on sites at either of the following URLs.
// Original gist:
// https://gist.githubusercontent.com/benyanke/994ce01b938fd2d1eb9ec1a0ecb79b35/
//
// Raw gist content:
// https://gist.githubusercontent.com/benyanke/994ce01b938fd2d1eb9ec1a0ecb79b35/raw/spiceworksTicketAutofill.js
@benyanke
benyanke / sns-to-slack.js
Last active July 7, 2021 16:02 — forked from vgeshel/function.js
AWS Lambda function for forwarding SNS notifications to Slack
// Added by Ben Yanke
// from https://gist.github.com/benyanke/862e446e5a816551928d8acc2d98b752
console.log('Loading function');
const https = require('https');
const url = require('url');
// SETUP
// urlToUse = in this environment variable, place the name of another environment variable which contains the key.
// This allows easy dev/prod switching.
@benyanke
benyanke / fidget.sh
Last active November 5, 2017 07:13
Bash fidget spinner
# Bash Fidget Spinner
# Could also be included in a bashrc file
fidget() {
start_time="0.02";
spin_efficiency="0.99";
end_time="3";
time="$start_time";
printf "\e[92mPress any key to give another spin...\n\n";
@benyanke
benyanke / notes.sh
Last active August 10, 2017 21:43
Note-taking bash script for meetings - add to .bashrc
#!/bin/bash
# Meeting note bash functions - include in your .bashrc file.
# Commands:
# note - Lists all past notes and their IDs.
# note help - This.
# note cd- Change your working directory to the notes storage folder
# note uncd - Change your working directory to the last working directory (useful for getting out of the notes storage folder)
# note new - Create a new note document. Will request user info then open it.
@benyanke
benyanke / Vagrantfile
Last active July 24, 2017 14:24
Vagrant file exerpts showing hosts editing
##############
# Box Config #
##############
# Specify any plugins you want installed on every `vagrant up` run
# You need the hostsupdated plugin, but the others are useful too.
required_plugins = %w(vagrant-hostsupdater vagrant-vbguest vagrant-triggers)
plugins_to_install = required_plugins.select { |plugin| not Vagrant.has_plugin? plugin }
@benyanke
benyanke / synology-key-fix.sh
Last active June 10, 2018 14:57
Fix ssh key login on synology
#!/bin/bash
homedir=$(eval echo ~$USER);
sudo chown $USER:users $homedir -R;
chmod 700 $homedir;
mkdir $homedir/.ssh;
touch $homedir/.ssh/authorized_keys;
chmod 700 $homedir/.ssh/;
chmod 600 $homedir/.ssh/authorized_keys;
# -*- mode: ruby -*-
# vi: set ft=ruby :
##############
# Box Config #
##############
# Currently supporting Parallels and VirtualBox
# Render all GABC files in current directory into PDF scores
function rendergabc() {
dir="`pwd`"
# Clean PDFs from folder
mkdir -p $dir/old >/dev/null 2>&1
rm $dir/old/* -f >/dev/null 2>&1
mv $dir/*.pdf $dir/old/ >/dev/null 2>&1
#!/bin/bash
# Network Share Incremental Backup Script
# By Ben Yanke <ben@benyanke.com>
# Last modified May, 2017
#
# This script allows you to make backups of a network share, and to keep incremental backups, using
# rsync's incremental backup feature. Old copies are retained without extra storage, because unchanged files are
# hard linked to old snapshots instead of newly copied. By this method, only one copy of any given file is
# stored, but you also have multiple, complete, nonincremental backups on your backup server.
@benyanke
benyanke / munch.c
Created May 5, 2017 17:19
Memory allocation example
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
// Wait [secs] seconds
void waitFor (unsigned int secs) {
unsigned int retTime = time(0) + secs; // Get finishing time.
while (time(0) < retTime); // Loop until it arrives.
}