Skip to content

Instantly share code, notes, and snippets.

@ahkui
ahkui / gcp-start-iap-tunnel-ssh-proxy-magic.sh
Last active March 27, 2026 08:03 — forked from netj/gcp-start-iap-tunnel-ssh-proxy-magic.sh
a nifty script for accessing with native SSH your IAP allowed Compute Engine instances
#!/usr/bin/env bash
# ~/.ssh/gcp-start-iap-tunnel-ssh-proxy-magic.sh
# a script to be used as SSH ProxyCommand to allow fully functional SSH access to any Google Cloud Compute Engine VMs allowing IAP access
#
# Author: ahkui <ahkui@outlook.com>
# Created: 2026-03-27
# See also:
# - https://gist.github.com/netj/df4f9de1fefd254ab11979be7035b5d0/#readme
# - https://cloud.google.com/iap/docs/using-tcp-forwarding
#
@ahkui
ahkui / load_script_from_chrome.md
Created April 14, 2021 02:41 — forked from ldong/load_script_from_chrome.md
load script from chrome dev tools

Load Script from Chrome Dev tools

var scriptSrc='//cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js';
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'script.js';
script.src = scriptSrc;
document.head.appendChild(script);
@ahkui
ahkui / canvasDownload.js
Created April 14, 2021 02:41 — forked from Kaundur/canvasDownload.js
JS to automatically download canvas as a png
// This code will automatically save the current canvas as a .png file.
// Its useful as it can be placed in a loop to grab multiple canvas frames, I use it to create thumbnail gifs for my blog
// Only seems to work with Chrome
// Get the canvas
var canvas = document.getElementById("canvas");
// Convert the canvas to data
var image = canvas.toDataURL();
// Create a link
var aDownloadLink = document.createElement('a');
@ahkui
ahkui / android_instructions.md
Created September 22, 2020 15:19 — forked from patrickhammond/android_instructions.md
Easily setup an Android development environment on a Mac

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

@ahkui
ahkui / pivot_example.php
Created December 24, 2018 16:35 — forked from fractefactos/pivot_example.php
Laravel Custom Pivot Model definition example
<?php
//https://github.com/laravel/framework/issues/2093#issuecomment-39154456
use Illuminate\Database\Eloquent\Model as Eloquent;
use Illuminate\Database\Eloquent\Relations\Pivot;
class User extends Eloquent {
public function groups() {
return $this->belongsToMany('Group');
@ahkui
ahkui / Secure Sessions Howto
Created March 24, 2018 21:20 — forked from nikmartin/A: Secure Sessions Howto
Secure sessions with Node.js, Connect, and Nginx as an SSL Proxy
Secure sessions are easy, but it's not very well documented, so I'm changing that.
Here's a recipe for secure sessions in Node.js when NginX is used as an SSL proxy:
The desired configuration for using NginX as an SSL proxy is to offload SSL processing
and to put a hardened web server in front of your Node.js application, like:
[NODE.JS APP] <- HTTP -> [NginX] <- HTTPS -> [CLIENT]
To do this, here's what you need to do:
@ahkui
ahkui / Sitcon
Last active January 6, 2018 19:56
linux install laravel
#!/bin/sh
apt-get update && \
apt-get install -y --no-install-recommends \
software-properties-common \
language-pack-en-base && \
LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php && \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
curl \
@ahkui
ahkui / laravel-mongodb-sentinel
Created January 1, 2018 11:25 — forked from Bodom78/laravel-mongodb-sentinel
Use the Sentinel 2.x authentication package with Laravel 5.1 and MongoDB
Work in Progress: More testing to be done.
At a glance Authentication, Activation, Throttle, Groups & Permissions seem to
be working.
Downside: Copy and modify files.
Upside: Not really much work to get it up and running.
Assumes you have Laravel 5.1, jenssegers/laravel-mongodb + session addon set up
and your app is namespaced to App/