This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Set $skeleton to desired path and rename the file to e.g. closet.sh | |
# Set $path to desired target directory to raise the skeleton | |
# Usage: closet project-name | |
name=$1 | |
path=~/repos/$name | |
skeleton=~/repos/sshow-node-module-skeleton | |
if [ "$1" == "--current" ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo "Who this :) <21" | |
if [ "$1" = "" ]; then | |
echo "Missing arg" | |
exit 1 | |
fi | |
filepath=$(which $1 2> /dev/null) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SECOND = 1000 | |
const MINUTE = SECOND * 60 | |
const HOUR = MINUTE * 60 | |
const DAY = HOUR * 24 | |
function timeAgo (date) { | |
const delta = Date.now() - parseInt(date) | |
const ago = { | |
day: delta / DAY, | |
hour: delta / HOUR, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Verify GitHub webhook signature header in Node.js | |
* Written by stigok and others (see gist link for contributor comments) | |
* https://gist.github.com/stigok/57d075c1cf2a609cb758898c0b202428 | |
* Licensed CC0 1.0 Universal | |
*/ | |
const crypto = require('crypto') | |
const express = require('express') | |
const bodyParser = require('body-parser') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# made for tghack '17 | |
# desc: upload a file chunked through a shell with length | |
# restrictions of commands. you might need to manually | |
# tune the BUFLEN to stay within the limits. sh syntax | |
# errors appears when you're out of bounds. | |
# | |
# todo: progress bar | |
# | |
HOST=${1} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function datestrings (date) { | |
const format = ['year', 'month', 'day', 'hour', 'minute', 'second'] | |
const parts = date | |
.toISOString() | |
.split(/[^\d]/g) | |
.slice(0, format.length) | |
.reduce((obj, part, i) => { | |
obj[format[i]] = part | |
return obj | |
}, {}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const args = process.argv.slice(2) | |
const key = args[0] | |
if (!key) { | |
console.error('Missing argument') | |
process.exit(1) | |
} | |
let buffer = '' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Create an issue on a Gogs repo specified by pwd's git remote | |
# Exit codes: | |
# 1 : Missing env | |
# 2 : Curl error | |
# 3 : JSON parsing error | |
# Get a key at https://<gogs-server-url>/user/settings/applications | |
api_server="$GOGS_SERVER_URL" | |
api_key="$GOGS_SERVER_API_KEY" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Restores ip6tables configuration. | |
# Expected to reject everything BUT: | |
# - icmpv6 from anywhere | |
# - ssh (22/tcp) from a whitelisted ipv6 subnet | |
# - openvpn (1094/udp) from anywhere | |
# | |
# stigok, july 2017 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear lock | |
!Maps Caps-Lock as Level3 Shift | |
keycode 66 = Mode_switch ISO_Level3_Shift | |
!Norwegian alpha chars ÆØÅ | |
keycode 47 = semicolon colon oslash Oslash | |
keycode 48 = apostrophe quotedbl ae AE | |
keycode 34 = bracketleft braceleft aring Aring |