Skip to content

Instantly share code, notes, and snippets.

View subhaze's full-sized avatar

Michael Russell subhaze

View GitHub Profile
@subhaze
subhaze / setup_crostini.sh
Last active June 9, 2019 17:28
Bash script to install/update apps on crositini
# source: https://www.reddit.com/r/Crostini/wiki/howto/vscode-docker-golang-example
# curl -s https://gist.githubusercontent.com/subhaze/75a38ede0fb4b32ac41a87e242ce0cde/raw/8bb0cde6e5cf7727f90615a16b3d6e6cdb51a940/setup_crostini.sh | bash -
get_go() {
# [get_golang.sh](https://gist.github.com/n8henrie/1043443463a4a511acf98aaa4f8f0f69)
# Download latest Golang release for AMD64
# https://dl.google.com/go/go1.10.linux-amd64.tar.gz
set -euf -o pipefail
# Install pre-reqs
@subhaze
subhaze / index.js
Last active November 29, 2018 15:08
Azure function to update IP on Cloudflare DNS; Usefull for DSM DDNS updates.
// URL set in Synology would look something like this:
// https://<YOUR_SUB_DOMAIN>.azurewebsites.net/api/HttpTriggerJS1?hostname=__HOSTNAME__&ip=__MYIP__&zoneid=__USERNAME__&key=__PASSWORD__&email=<YOUR_CF_EMAIL_LOGIN>&dnsidentifier=<YOUR_DNS_ID_FROM_CF>&recordtype=A
module.exports = function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');
var http = require('https');
var hostname = req.query.hostname;
var ip = req.query.ip;
var zoneid = req.query.zoneid;
@subhaze
subhaze / deploy.cmd
Created January 12, 2018 17:12 — forked from benmccallum/deploy.cmd
Purge an Azure CDN cache with cURL, jq and deploy.cmd batch file
:: Below is an example of extending a deploy.cmd file (see kudu custom deployment scripts) to clear an Azure CDN endpoint
:: using the Azure Resource Manager (ARM) API with help of cURL.exe and jq.exe utils.
:: 4. Purge CDN cache of all caches files
:: Requires an application to be setup in the Azure Active Directory on the same tenant,
:: with a client id and key/secret, and permissions to the Azure CDN Endpoint (CDN Endpoint Contributor)
::SET CLIENT_ID="from-app-settings"
::SET CLIENT_SECRET="from-app-settings"
IF NOT DEFINED CLIENT_ID (
echo 4. Skipping Azure CDN cache purge. App Setting "CLIENT_ID" was not found. Potentially this is a local test deployment run.
@subhaze
subhaze / queryParams.js
Last active September 5, 2017 19:56
Parse Query Params
export const queryParams = (locationSearch = window.location.search) =>
locationSearch
.substr(1)
.split('&')
.reduce(
(acc, curr) =>
Object.assign(
acc, curr
.split('=')
.reduce((acc, curr) => ({ [acc]: _decodeURIComponent(curr) })),
%YAML1.2
---
name: JavaScript TS
file_extensions:
- js
scope: source.ts
contexts:
main:
- match: ""
push: "Packages/JavaScript/JavaScript.sublime-syntax"
@subhaze
subhaze / codekit-babel.hook.sh
Created April 29, 2016 20:16
ES2015 Build with npm/CodeKit
#!/bin/bash
browserify src/main.js -t babelify > dist/main.js
osascript -e 'display notification "npm run build completed" with title "CodeKit Hook"'
@subhaze
subhaze / flatMap [Array#reduce].markdown
Created April 22, 2016 14:25
flatMap [Array#reduce]
@subhaze
subhaze / index.html
Last active April 19, 2016 23:57
pipeline [Array#reduce]
<pre style="padding: 20px"><code class="hljs js">
function pipeline(data, ...fns){
return fns.reduce((acc, curr) => curr(acc), data);
}
let abc = pipeline('a', (v)=>v+'b', (v)=>v+'c');
console.log(abc);
// "abc"
@subhaze
subhaze / concatAll [Array#reduce].markdown
Last active April 19, 2016 22:36
concatAll [Array#reduce]
@subhaze
subhaze / RxJS Sequence Memory.markdown
Last active April 18, 2016 00:07
RxJS Sequence Memory