Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Russell subhaze

View GitHub Profile
@subhaze
subhaze / setup_crostini.sh
Last active Jun 9, 2019
Bash script to install/update apps on crositini
View setup_crostini.sh
# 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 Nov 29, 2018
Azure function to update IP on Cloudflare DNS; Usefull for DSM DDNS updates.
View index.js
// 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 Jan 12, 2018 — forked from benmccallum/deploy.cmd
Purge an Azure CDN cache with cURL, jq and deploy.cmd batch file
View deploy.cmd
:: 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 Sep 5, 2017
Parse Query Params
View queryParams.js
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) })),
View JavaScript TS.sublime-syntax
%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 Apr 29, 2016
ES2015 Build with npm/CodeKit
View codekit-babel.hook.sh
#!/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 / index.html
Last active Apr 19, 2016
pipeline [Array#reduce]
View index.html
<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"
View RxJS Sequence Memory.markdown