Skip to content

Instantly share code, notes, and snippets.

View mike623's full-sized avatar

404 Not Found mike623

View GitHub Profile
@mike623
mike623 / git-migrate
Created June 2, 2020 11:27
fork on current commit and reset move back old branch
#!/bin/bash
branch_name=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD);
echo "create new branch and reset prev of $branch_name";
git checkout -b $1
git checkout $branch_name
# reset pervious version
git reset --hard HEAD~1
git checkout $1
#!/bin/bash
(
IFS=$'\n'
for y in $(ls $1)
do
mv $1/`echo $y | sed 's/ /\\ /g'` $1/`echo "$y" | sed 's/ /_/g'`
done
)
#!/bin/bash
# unprotect multiple pdf files in a directory with qpdf 10Jan20
# run the script from the same directory as the files
if [ -d output ];
then
echo "output directory exists"
else
mkdir output
fi
@mike623
mike623 / wenv
Last active January 19, 2019 05:30
wrap-env
#!/bin/bash
#
# Place this script into your script folder and use like this:
#
# ./script/wrap-env.sh .env $(npm bin grunt)/grunt serve
#
# Your .env file must have exports in it, not just a list of variable like Docker env files work
#
usage="$(basename "$0") [-h] .env_file command [arg ...]
@mike623
mike623 / index.js
Created August 22, 2018 04:05
get message from mandrill inbound
var talon = require("talon");
var extractSignature = talon.signature.bruteforce.extractSignature;
var planer = require('planer');
const cheerio = require('cheerio')
// https://github.com/PrettyHotProgrammer/mandrill-inbound-parser/blob/master/mandrill-inbound-parser.js
// mandrill_events%3D%5B%7B%22event%22%3A%22inbound
const parse = function(inboundMsg) {
if (inboundMsg.includes('mandrill_events=%5B%7B%22event%22%3A%22inbound')) {
return decodeURIComponent(inboundMsg)
@mike623
mike623 / Code-practice.js
Last active May 31, 2018 07:15
lynk-101
function logPeople1() {
var sheet = SpreadsheetApp.getActiveSheet();
var data = sheet.getDataRange().getValues();
for (var i = 0; i < data.length; i++) {
Logger.log('name: ' + data[i][0]);
}
}
function logPeople2() {
var sheet = SpreadsheetApp.getActiveSheet();
@mike623
mike623 / Code.js
Created May 30, 2018 09:44
Lynk-task
// 0. create function called getNameSummary:
// 1. get ui
// 2. concat string and variable = 'string' + x
// 3. newline = '\n'
// 4. ui.alert
// 5. build from logPeople3 function
// 6. logPeople3 function accpet variable sheet passed from 'getNameSummary'
function getNameSummary() {
var ui = SpreadsheetApp.getUi();
var result = ""
@mike623
mike623 / start.sh
Last active April 15, 2018 17:52
recording using streamlink
# start from end
streamlink -o [name].ts [URL] best
# start from very first
streamlink --hls-live-restart -o [name].ts [URL] best
# start from offest from end
streamlink --hls-start-offset [HH:MM:SS] -o [name].ts [URL] best
@mike623
mike623 / git-log-by-date.sh
Created April 11, 2017 02:54
git log by date
git log --no-merges --format="%cd" --date=short | sort -u -r | while read DATE ; do
echo
echo [$DATE]
GIT_PAGER=cat git log --no-merges --format=" * %s" --since=$DATE --until=$NEXT
NEXT=$DATE
done
@mike623
mike623 / scoreMethod.txt
Created March 30, 2017 02:35
basically total the scores
Game 1 Mike 3 : 0 Eric
Game 2 Mike 3 : 1 Eric
Game 3 Mike 1 : 3 Eric
Offense Scale:
3 = 95
2 = 80
1 = 70
0 = 0