Skip to content

Instantly share code, notes, and snippets.

View montchr's full-sized avatar
I may be slow to respond.

chris montgomery montchr

I may be slow to respond.
View GitHub Profile
#!/usr/bin/php -d open_basedir=/usr/syno/bin/ddns
<?php
if ($argc !== 5) {
echo 'badparam';
exit();
}
// Entered into DSM (Control Panel > External Access > DDNS)
$username = (string) $argv[1]; // Resource ID
@montchr
montchr / ANSI.md
Created April 28, 2022 15:23 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@montchr
montchr / changelog.sh
Created July 6, 2016 20:00 — forked from kingkool68/changelog.sh
Bash script to generate a markdown change log of GitHub pull requests between tagged releases
#!/bin/bash
# Generate a Markdown change log of pull requests from commits between two tags
# Author: Russell Heimlich
# URL: https://gist.github.com/kingkool68/09a201a35c83e43af08fcbacee5c315a
# HOW TO USE
# Copy this script to a directory under Git version control
# Make the script executable i.e. chmod +x changelog.sh
# Run it! ./changelog.sh
# Check CHANGELOG.md to see your results
<?php
/**
* Generates a domain-mapping safe URL on WordPress.com
* Core's ajaxurl uses admin_url() which returns *.wordpress.com which doesn't work for the front-end on domain-mapped sites.
* This works around that and generates the correct URL based on context.
*/
function my_admin_ajax_url( $path = '' ) {
if ( is_admin() )
$url = admin_url( 'admin-ajax.php' );
else
#!/bin/sh
libs=( "/usr/local/lib/libmacfuse_i32.2.dylib" \
"/usr/local/lib/libosxfuse_i32.2.dylib" \
"/usr/local/lib/libosxfuse_i64.2.dylib" \
"/usr/local/lib/libmacfuse_i64.2.dylib" \
"/usr/local/lib/libosxfuse_i32.la" \
"/usr/local/lib/libosxfuse_i64.la" \
"/usr/local/lib/pkgconfig/osxfuse.pc" )
#!/bin/bash
# Functions ==============================================
# return 1 if global command line program installed, else 0
# example
# echo "node: $(program_is_installed node)"
program_is_installed () {
# set to 1 initially
local return_=1
#!/bin/bash
# works with a file called VERSION in the current directory,
# the contents of which should be a semantic version number
# such as "1.2.3"
# this script will display the current version, automatically
# suggest a "minor" version update, and ask for input to use
# the suggestion, or a newly entered value.
@montchr
montchr / 0_reuse_code.js
Created March 9, 2014 17:14
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console