Skip to content

Instantly share code, notes, and snippets.

View github-mirror.py
import os
import sys
import requests
from git import Repo
from string import Template
# Get the command-line arguments
user_type = sys.argv[1]
user_id = sys.argv[2]
@markashleybell
markashleybell / github-mirror.ps1
Created Aug 10, 2019
Local GitHub repository backups with Powershell
View github-mirror.ps1
param(
[Parameter(Mandatory=$true)]
[string]$Username,
[Parameter(Mandatory=$true)]
[string]$GitHubAccessToken,
[Parameter(Mandatory=$true)]
[string]$BackupFolderPath
)
$initialWorkingPath = Convert-Path '.'
@markashleybell
markashleybell / dropbox-db-backup.ps1
Last active Feb 16, 2021
Rolling backup of one or more SQL Server databases to Dropbox.
View dropbox-db-backup.ps1
param(
[Parameter(Mandatory=$true)]
[string[]]$DatabaseNames,
[Parameter(Mandatory=$true)]
[string]$AccessToken,
[Parameter(Mandatory=$true)]
[string]$BackupPath
)
function Upload-FileToDropbox {
@markashleybell
markashleybell / crypto-aes-gcm.js
Created Apr 15, 2019 — forked from chrisveness/crypto-aes-gcm.js
Uses the SubtleCrypto interface of the Web Cryptography API to encrypt and decrypt text using AES-GCM (AES Galois counter mode).
View crypto-aes-gcm.js
/**
* Encrypts plaintext using AES-GCM with supplied password, for decryption with aesGcmDecrypt().
* (c) Chris Veness MIT Licence
*
* @param {String} plaintext - Plaintext to be encrypted.
* @param {String} password - Password to use to encrypt plaintext.
* @returns {String} Encrypted ciphertext.
*
* @example
* const ciphertext = await aesGcmEncrypt('my secret text', 'pw');
@markashleybell
markashleybell / index.html
Created Apr 5, 2013
Queueing asynchronous functions in JavaScript so that each is executed after the previous function has completed; useful when lookup data or templates are required to be loaded before other code can be executed.
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Queueing Asynchronous Functions in JavaScript</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="queue.js"></script>
</head>
<body>
<p><input type="button" id="process-button" value="Process Queue" /></p>
<div id="output"></div>
View gist:1139238
<form id="demo2" action="" method="post">
<p class="mab-checkbutton-container">
<input type="checkbox" value="1" name="cb-1" id="cb-1" /> <label for="cb-1">Checkbox 1</label>
<input type="checkbox" value="1" checked="checked" name="cb-2" id="cb-2" /> <label for="cb-2">Checkbox 2</label>
<input type="checkbox" value="1" checked="checked" name="cb-3" id="cb-3" /> <label for="cb-3">Checkbox 3</label>
</p>
<p><input type="submit" value="Submit Form and Show Values" /></p>
</form>