These are copied from this article by Nate McMaster. I've been Googling for it every time I needed it, so I decided it would be a good idea to save these templates somewhere, in case the article ever goes away.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ErrorActionPreference = "Stop" | |
function Main { | |
"This script creates a zip file that contains all files changed between two commits." | |
"Commits can be specified as commit IDs (SHA) or as branch names." | |
"For example: 'master' or 'ff39683ed6'" | |
"" | |
$git_dir = Read-Host -Prompt "Git directory" | |
$to_commit = Read-Host -Prompt "Commit to deploy" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MODULE_BODIES = { | |
// This is the body of the file foo/index.ts, wrapped in a function | |
["./foo/index.ts"]: function (module) { | |
const file = __webpack_resolve__("./foo/file.ts") | |
module.exports.Service = file.Service | |
}, | |
// This is the body of the file foo/file.ts, wrapped in a function | |
["./foo/file.ts"]: function (module) { |
Write the base image to the SD card
mkfs.vfat
on Arch comes from dosfstools
(source)
SOME KIND OF PACMAN INIT (https://archlinuxarm.org/forum/viewtopic.php?t=12796)
pacman-key --init
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define NONEST | |
void Main() | |
{ | |
Database.SetInitializer<MyContext>(null); | |
using (var db = new MyContext()) | |
{ | |
var date = "20180315"; | |
var query = from row in db.Tabl1 | |
where SqlFunctions.DateDiff( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading; | |
namespace ConsoleApp1 | |
{ | |
class Program | |
{ | |
static void Main() | |
{ | |
var worker = new Thread(Worker); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using 5.1.23 because 5.1.70 has a bug that prevents the GUI from opening | |
$tag = "5.1.23" | |
$downloadUrl = "https://github.com/ChangemakerStudios/Papercut/releases/download/$tag/Papercut.Setup.exe" | |
$outputFileName = "$($env:TEMP)\Papercut.Setup.exe" | |
# Download | |
del $outputFileName -Force -ErrorAction SilentlyContinue | |
Invoke-WebRequest $downloadUrl -OutFile $outputFileName | |
# Install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -exuo pipefail | |
TRUNK=master | |
REWRITE_BRANCH=master-to-rewrite | |
NEW_BRANCH_BOOKMARK=master-filtered | |
LAST_IMPORT_BRANCH=master-lastimport | |
STATE=master-state | |
INDEX_FILTER_SCRIPT='git rm -r --cached --ignore-unmatch bad_directory' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static function redirectHttpsToHttp(oSession: Session, fromHost, toHost) { | |
if (oSession.HostnameIs(fromHost)) | |
{ | |
// Handle CONNECT Tunnels | |
if (oSession.HTTPMethodIs("CONNECT")) | |
{ | |
oSession["x-replywithtunnel"] = "FakeTunnel"; | |
return true; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fn1() { | |
return function fn2(ARG1) { | |
return callApi({ foo: ARG1 }) | |
.then(handler); | |
function handler(response) { | |
const obj = { PROP: response }; | |
return (inlinedFunction(obj.PROP)) | |
.then(fn3()); | |
} |