Skip to content

Instantly share code, notes, and snippets.

View kaihendry's full-sized avatar

Kai Hendry kaihendry

View GitHub Profile
@sators
sators / connect.php
Last active April 11, 2024 07:17
PHP MySQLi Amazon Aurora RDS EC2 IAM Role Based Authentication
<?php
/********* CONFIG ********/
$clusterEndpoint = "";
$clusterPort = 3306;
$clusterRegion = "us-east-1";
$dbUsername = "";
$dbDatabase = "";
/*************************/
@jclosure
jclosure / bidirectional_clipboard.md
Last active February 8, 2023 21:01
Setup a bi-directional shared clipboard between client macos and linux server for remote terminal emacs.

Using netcat and ssh tunnels, create a shared clipboard allowing client and server clipboards to be fused

Serve pbcopy and pbpaste on Mac's localhost

NOTE: That we are making the assumption that the clipboards are sending and receiving UTF-8 encoded bytes

~/Library/LaunchAgents/pbcopy.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@brunoamaral
brunoamaral / copyright.html
Created May 31, 2020 09:24
Automatic Unsplash Copyright Shortcode for Hugo
@idontwantcookies
idontwantcookies / arch-backup.sh
Last active February 5, 2022 12:54
Simple bash scripts to backup and restore several archlinux config files
# Storing installed package names
echo $(pacman -Qentq) > pacman.bak
echo $(pacman -Qemtq) > yay.bak
echo $(pacman -Qdq) > pacman-optdep.bak
# Global config
cp /etc/pacman.conf pacman.conf.bak
cp -r /etc/pacman.d/ pacman.d.bak
cp /etc/hosts hosts.bak
cp /etc/hostname hostname.bak
@marcoscaceres
marcoscaceres / webshare.md
Last active August 24, 2020 01:38
How we implemented web share

How we implemented Web Share

Written by: Marcos Cáceres Technical reviewers: Kagami Sascha Rosylight, Sid Vishnoi.

This post describes how we implemented the Web Share API in Gecko, which is exposed as a DOM API to the Web. As it can be challenging to know how to implement new features in Gecko, it's intended to serve as a reference guide for other Gecko developers who need to implement similar DOM APIs in the future. For the impatient, the final implementation is available in Phabricator.

Before you start - some general advice about how things work

The following subsections give some general advice about what you should expect as you embark on implementing a new DOM feature.

var request = require('request');
var async = require('async');
var faker = require('faker');
var _ = require('lodash');
if (!process.env.PEAK_PERIOD_MINS) {
process.env.PEAK_PERIOD_MINS = '30';
}
var PEAK_PERIOD_MINS = parseInt(process.env.PEAK_PERIOD_MINS, 10) * 60 * 1000;
var MAX_CONCURRENT = parseInt(process.env.MAX_CONCURRENT, 10) || 100;
@RobertAKARobin
RobertAKARobin / safari.md
Last active January 5, 2024 05:41
Safari's date-picker is the cause of 1/3 of our customer support issues

Safari's date-picker is the cause of 1/3 of our customer support issues

...and obviously we're building a workaround. But I'm absolutely flabbergasted that a standard <input type="date"> HTML field, in a standard browser, from a company that bases its reputation good design, could be so dreadful.

The context

I'm the developer for a startup that sells a genetic test to recommend medications for high blood pressure. For medical reasons we need to know our customers' birth date. Most of our customers are in their 60s or older. We've found that many of them use iPads or iPhones. And they're the ones who complain to our customer support that our site is unusable.

The problem