Skip to content

Instantly share code, notes, and snippets.

View markembling's full-sized avatar

Mark Embling markembling

View GitHub Profile
/*
* Change detection for forms
*
* @author Mark Embling
*
* Initialise on applicable forms using the jQuery plugin.
* Recommended one per page but this is not a requirement.
*
* Copyright © 2022 Mark Embling
*
@markembling
markembling / profile.ps1
Created June 12, 2018 13:02
Allow SSH agent installed and managed by posh-git to also be usable from other non-PowerShell processes (e.g. Tower Git client for Windows).
# Add this into your profile AFTER posh-git has been loaded and the SSH agent
# has been started.
[void][Environment]::SetEnvironmentVariable("SSH_AGENT_PID", [Environment]::GetEnvironmentVariable("SSH_AGENT_PID"), [EnvironmentVariableTarget]::User)
[void][Environment]::SetEnvironmentVariable("SSH_AUTH_SOCK", [Environment]::GetEnvironmentVariable("SSH_AUTH_SOCK"), [EnvironmentVariableTarget]::User)
# It may make it a little slower (as apparently writing to the user environment
# is slow), but will mean the SSH agent is visible to other processes.
@markembling
markembling / settings-actual.json
Last active March 17, 2017 12:32
JSON snippets associated with the Quora question at http://bit.ly/2mX0vh5
{
"editor.rulers": [
80,
120
],
"editor.renderWhitespace": "boundary",
"editor.minimap.enabled": true,
"editor.minimap.renderCharacters": false,
"editor.dragAndDrop": true,
"files.hotExit": "off",
@markembling
markembling / aliases.ps1
Last active May 25, 2023 07:07
Current Powershell Profile
#########################################
# Convenient PowerShell Alias functions #
#########################################
# Open the given directory in Explorer
# Usage: open .
function open {
explorer $args
}
// Mostly cribbed together from https://gist.github.com/mathewbyrne/1280286
// Also: http://stackoverflow.com/questions/1144783/how-to-replace-all-occurrences-of-a-string-in-javascript
function _escapeRegex(str) {
return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
}
function slugify(str) {
str = str.trim();
str = str.toLowerCase();
@markembling
markembling / Program.cs
Created November 9, 2016 17:44
Tiny demo app which shows listing out all loaded assemblies and their information, and also listing out all references.
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
Console.WriteLine("CLR");
Console.WriteLine(Environment.Version);
mark@silicon:~$ sudo pip install blinkstick
Downloading/unpacking blinkstick
Downloading BlinkStick-0.7.0.tar.gz
Running setup.py egg_info for package blinkstick
Downloading/unpacking grapefruit==0.1a3 (from blinkstick)
You are installing an externally hosted file. Future versions of pip will default to disallowing externally hosted files.
You are installing a potentially insecure and unverifiable file. Future versions of pip will default to disallowing insecure files.
Downloading grapefruit-0.1a3.tar.gz (194kB): 194kB downloaded
Running setup.py egg_info for package grapefruit
@markembling
markembling / can_haz_msg.py
Created August 6, 2013 19:48
Is something like this possible?
import mosquitto
client = mosquitto.Mosquitto("can-haz-msg")
client.connect("mqtt.example.com")
client.subscribe("my-topic")
for msg in client.wait_for_next_message():
print msg.payload
@markembling
markembling / gist:5435834
Last active December 16, 2015 12:39
Call for help... I can't pick a name!

Help me out

I want to rename Elephant, as there's already a company out there called 'Elephant Backup' and I'd like to avoid confusion.


It is done. Meet storelet


@markembling
markembling / LICENCE
Created December 9, 2012 13:16
Google Drive & Spreadsheets Using OAuth 2.0 Service Account Example. See http://markembling.info/2012/12/google-spreadsheet-dotnet-oauth2-service-account
Copyright (c) 2012, Mark Embling
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Mark Embling nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.