Skip to content

Instantly share code, notes, and snippets.

View dcai's full-sized avatar
🥃
need a drink

dcai

🥃
need a drink
View GitHub Profile
@dcai
dcai / Vagrantfile
Last active December 10, 2018 11:46
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.box_check_update = false
config.vm.network "forwarded_port", guest: 9001, host: 9001
# Create a private network, which allows host-only access to the machine
@dcai
dcai / grid.ahk
Created February 28, 2017 02:46
autohotkey grid
; https://autohotkey.com/board/topic/72918-my-ahk-stuff/
;
; AutoHotkey Version: 1.x
; Language: English
; Platform: windows
; Author: Andre Blanchard
;
;Windows Slide
; Script Function:
; This script allows you to move around windows by pressing the hotkey of your choice.
@dcai
dcai / load-jquery-underscore.js
Last active September 28, 2017 13:33
Load jQuery and Underscore in chrome console
(w => {
const js = w.document.createElement('script');
js.setAttribute("src", '//cdn.jsdelivr.net/g/jquery@3.1.1,underscorejs@1.8.3');
w.document.head.appendChild(js);
return 'Loaded Javascript Libraries';
})(window);
@dcai
dcai / iterm2.md
Created November 28, 2016 03:20
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
Previous Tab + Left Arrow
Next Tab + Right Arrow
Go to Tab + Number
Go to Window + Option + Number
Go to Split Pane by Direction + Option + Arrow
Go to Split Pane by Order of Use + ] , + [
#!/usr/bin/env perl
use Getopt::Std;
use strict;
use Term::ANSIColor;
my %opts;
getopts('hic:l:',\%opts);
if ($opts{h}){
print<<EoF;
Use -l to specify the pattern(s) to highlight. To specify more than one
@dcai
dcai / 00_apt-essentials.bash
Last active October 4, 2021 14:23
ubuntu packages
#!/bin/bash
sudo apt update
sudo apt-get install -y \
apt-transport-https \
apt-utils \
ca-certificates \
locales \
gnupg2 \
software-properties-common \
wget
@dcai
dcai / pcp.conf
Last active October 22, 2015 08:36
pgpool II config
# PCP Client Authentication Configuration File
# ============================================
#
# This file contains user ID and his password for pgpool
# communication manager authentication.
#
# Note that users defined here do not need to be PostgreSQL
# users. These users are authorized ONLY for pgpool
# communication manager.
#
@dcai
dcai / ca.cert
Created July 24, 2015 00:09
My CA public certificate
-----BEGIN CERTIFICATE-----
MIIGLTCCBBWgAwIBAgIJAMHi/0z+LKQcMA0GCSqGSIb3DQEBDQUAMGwxCzAJBgNV
BAYTAkFVMQwwCgYDVQQIEwNOU1cxFjAUBgNVBAoTDURvbmdzaGVuZyBDYWkxFjAU
BgNVBAMTDWRvbmdzaGVuZy5vcmcxHzAdBgkqhkiG9w0BCQEWEGhpQGRvbmdzaGVu
Zy5vcmcwHhcNMTQxMDIyMDUwNDI1WhcNMjQxMDE5MDUwNDI1WjBsMQswCQYDVQQG
EwJBVTEMMAoGA1UECBMDTlNXMRYwFAYDVQQKEw1Eb25nc2hlbmcgQ2FpMRYwFAYD
VQQDEw1kb25nc2hlbmcub3JnMR8wHQYJKoZIhvcNAQkBFhBoaUBkb25nc2hlbmcu
b3JnMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA7rHCBJbrQXnf5fgP
lEdOKG2DamPRdCzeSJH75uERxpVD8J+9vz8g+RJJtU50uotKbn1JzFXKiyxbgFyA
WC5fNuIHSil6LoXMqu+RycUT1snyx4Uv/Bj1kCaHFl8RYvzK0wK5aRKdR0vqK1jE
@dcai
dcai / calendar_form.php
Last active August 11, 2016 00:01
basic moodle form
<?php
require_once("$CFG->libdir/formslib.php");
class calendar_form extends moodleform {
public function definition() {
global $CFG;
$mform = $this->_form;
$mform->addElement('text', 'calendarname', get_string('calendarname', 'block_gcal'));
@dcai
dcai / minimal_moodle_page.php
Last active August 10, 2016 23:59
minimal moodle page
<?php
require_once(dirname(dirname(__DIR__)).'/config.php');
require_login();
$context = context_system::instance();
$url = new moodle_url('/blocks/gcal/mappings.php');
$PAGE->set_url($url);
$PAGE->set_context($context);