Skip to content

Instantly share code, notes, and snippets.

Avatar

Chew Choon Keat choonkeat

View GitHub Profile
@choonkeat
choonkeat / destructuring.md
Created May 20, 2022 01:12 — forked from yang-wei/destructuring.md
Elm Destructuring (or Pattern Matching) cheatsheet
View destructuring.md

Should be work with 0.18

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !

Tuple

myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))
@choonkeat
choonkeat / LinusTalk200705Transcript.wiki
Created December 28, 2019 13:04 — forked from dukeofgaming/LinusTalk200705Transcript.wiki
Linus google tech talk transcript
View LinusTalk200705Transcript.wiki

This is transcript of Tech Talk: Linus Torvalds on Git at Google on YouTube.


Andrew:

Thank you, for coming everybody, some of you probably already have heard of Linus Torvalds, those of you who haven't, you are the people with Macintoshes on your laps.

View disable mcafee endpoint protection.md

method 1

sudo /usr/local/McAfee/AntiMalware/VSControl stopoas

alternatively

sudo defaults write /Library/Preferences/com.mcafee.ssm.antimalware.plist OAS_Enable -bool False
sudo /usr/local/McAfee/AntiMalware/VSControl stop
sudo /usr/local/McAfee/AntiMalware/VSControl reload
@choonkeat
choonkeat / underscore.go
Created February 7, 2018 14:49 — forked from regeda/underscore.go
Convert CamelCase to underscore in golang with UTF-8 support.
View underscore.go
package main
import (
"testing"
"unicode"
"unicode/utf8"
"github.com/stretchr/testify/assert"
)
View cruby.txt
Calculating -------------------------------------
@choonkeat 1.000 i/100ms
@sferik 1.000 i/100ms
-------------------------------------------------
@choonkeat 0.100 (± 0.0%) i/s - 1.000 in 10.000901s
@sferik 0.099 (± 0.0%) i/s - 1.000 in 10.087707s
Comparison:
@choonkeat: 0.1 i/s
@sferik: 0.1 i/s - 1.01x slower
View GIF-Screencast-OSX.md

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

View harwriter.py
#!/usr/bin/env python
import binascii, sys, json
from libmproxy import version, tnetstring, flow
from datetime import datetime
def create_har(flows):
return {
"log":{
@choonkeat
choonkeat / zoom.js
Created June 18, 2010 00:15 — forked from mislav/zoom.js
View zoom.js
/* tested on the iPad and iPhone */
function getZoomFactor() {
var deviceWidth, landscape = Math.abs(window.orientation) == 90
// workaround for strange screen.height on the iPhone (v3.1.3)
if (window.screen.width == 320) deviceWidth = landscape ? 480 : 320
else deviceWidth = window.screen[landscape ? "height" : "width"]
return deviceWidth / window.innerWidth
}