Skip to content

Instantly share code, notes, and snippets.

@impaler
impaler / mount_smbfs.sh
Created October 17, 2023 21:26 — forked from natritmeyer/mount_smbfs.sh
How to mount and unmount a SMB share on Mac OS X (using mount_smbfs)
#Mounting the share is a 2 stage process:
# 1. Create a directory that will be the mount point
# 2. Mount the share to that directory
#Create the mount point:
mkdir share_name
#Mount the share:
mount_smbfs //username:password@server.name/share_name share_name/
#!/bin/bash
set -eo pipefail
echo "Deleting existing hosting releases"
SITE=$1
echo "Site: $SITE"
HEADER_AUTH="Authorization: Bearer "$(gcloud auth application-default print-access-token)"";
@impaler
impaler / gist:228f5ff4c44a4b006a32701fdcb0a5c3
Last active August 22, 2018 03:39 — forked from ctrl-freak/gist:9abb5aea0d89d7bd9df6a3d0ac08b73c
Android ADB `adb shell input keyevent` Codes
// http://stackoverflow.com/questions/7789826/adb-shell-input-events
adb shell input keyevent 82
0 --> "KEYCODE_0"
1 --> "KEYCODE_SOFT_LEFT"
2 --> "KEYCODE_SOFT_RIGHT"
3 --> "KEYCODE_HOME"
4 --> "KEYCODE_BACK"
5 --> "KEYCODE_CALL"
@impaler
impaler / mongo-autostart-osx.md
Created August 1, 2018 05:17 — forked from subfuzion/mongo-autostart-osx.md
mongo auto start on OS X

Install with Homebrew

brew install mongodb

Set up launchctl to auto start mongod

$ ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents

/usr/local/opt/mongodb/ is a symlink to /usr/local/Cellar/mongodb/x.y.z (e.g., 2.4.9)

@impaler
impaler / compile.js
Last active July 1, 2022 00:54
Compile webpack with typescript in memory
// based on code from https://stackoverflow.com/questions/38779924/compiling-webpack-in-memory-but-resolving-to-node-modules-on-disk
import * as webpack from 'webpack'
import * as MemoryFileSystem from 'memory-fs'
import * as path from 'path'
import * as fs from 'fs'
import * as promisify from 'util.promisify'
const memFs = new MemoryFileSystem()
const statOrig = memFs.stat.bind(memFs)
@impaler
impaler / gist:bc9b3befb3bd929c90f921da652aa3a1
Created January 8, 2017 08:44
Debug node child_process fork
// Debug me with a tool like webstorm nad the child process will step in with your breakpoints :)
const fork = require('child-process-promise').fork
const debug = typeof v8debug === 'object'
export async function forkBin (args, debugPort) {
debugPort = debugPort || 40894
let execArgv = debug ? ['--debug-brk', `--debug=${debugPort}`] : []
const forkPromise = fork(binPath, args, {
@impaler
impaler / get-available-port.js
Created January 6, 2017 10:18
Get an available port from a promise using the nodejs net module
const net = require('net')
async function getAvailablePort () {
return new Promise((resolve, reject) => {
let server = net.createServer()
server.unref()
server.on('error', reject)
// zero gives it away ;)
server.listen(0, () => {
@impaler
impaler / docker_remote_api
Created September 20, 2015 09:50 — forked from simonsdave/docker_remote_api
enabling docker remote API on Ubuntu 14.04 on GCE
* spin up a VM on GCE and
install docker (based on [these](https://docs.docker.com/installation/ubuntulinux/) instructions)
```bash
gcloud compute instances create dave --machine-type n1-standard-1 --image ubuntu-14-04
gcloud compute ssh dave
wget -qO- https://get.docker.com/ | sh
```
* to verify install is working
@impaler
impaler / gist:e161f018fdcec09b0e06
Last active August 29, 2015 14:22
winjs download a file
console.log('download a file', device.platform, location.href);
function DownloadFile(uriString, fileName) {
try {
console.log("started");
var applicationData = Windows.Storage.ApplicationData.current;
console.log("applicationData", applicationData.localFolder.path);
applicationData.localFolder