Skip to content

Instantly share code, notes, and snippets.

@kentliau
kentliau / prezto.sh
Last active December 5, 2023 05:47 — forked from arvind-iyer/prezto.sh
Install prezto on ubuntu
#!/bin/bash
prezto.sh(){
#clear
#sudo apt-get install -y git
#sudo apt-get update && sudo apt-get install -y zsh
# Get prezto
#git clone --recursive https://github.com/sorin-ionescu/prezto.git ~/.zprezto
# Backup zsh config if it exists
@kentliau
kentliau / ssh_without_pem
Created August 19, 2023 04:10 — forked from kevinjam/ssh_without_pem
Access EC2 Linux box over ssh without .pem file SHELL SSH AWS AMAZON LINUX EC2 BASH You may be in the situation where you need to access your EC2 instance from any machine, not necessarily your own. It's a pain to carry around your .pem file and a bad idea to leave it on someone elses machine too. Here's a solution to let you login to your insta…
1. Login to your EC2 instance using your .pem file
ssh -i your_pem_file.pem ubuntu@ec2-________.compute-1.amazonaws.com
2. Create a new user that will access the instance using a password:
$ sudo useradd -s /bin/bash -m -d /home/USERNAME -g root USERNAME
where:
-s /bin/bash : use /bin/bash as the standard shell
-m -d /home/USERNAME : create a home directory at /home/USERNAME
@kentliau
kentliau / CalculatorView.swift
Last active November 27, 2016 21:29 — forked from natecook1000/CalculatorView.swift
An IBInspectable Calculator Construction Set (Swift 3)
// CalculatorView.swift
// as seen in http://nshipster.com/ibinspectable-ibdesignable/
//
// (c) 2015 Nate Cook, licensed under the MIT license
/// The alignment for drawing an String inside a bounding rectangle.
import UIKit
enum NCStringAlignment {
@kentliau
kentliau / open-chrome-tabs-in-safari.scpt
Last active July 16, 2023 15:52 — forked from paulirish/open-chrome-tabs-in-safari.scpt
open all chrome tabs of all windows in safari
tell application "Google Chrome"
set window_list to every window
repeat with the_window in window_list
# For each Window in Chrome, create a new Window in Safari respectively
tell application "Safari"
make new document
activate
@kentliau
kentliau / TreeView.swift
Created September 17, 2016 17:41 — forked from chris-hatton/TreeView.swift
Weekend Playground fun: TreeView
import UIKit
typealias Bough = (rotation:CGFloat, length: CGFloat, scale: CGFloat, hue: CGFloat)
final class TreeView : UIView {
private let limit = 10
private let boughs : [Bough] = [
(rotation: -25, length: 85, scale: 0.75, hue: 0.04),
(rotation: 30, length: 100, scale: 0.65, hue: 0.02)
@kentliau
kentliau / quick-osx-keydnap-check
Created September 6, 2016 11:43
Does a quick check for OS X malware OSX/Keydnap.
if [ -f "/Applications/Transmission.app/Contents/Resources/License.rtf" ] || [ -f "/Volumes/Transmission/Transmission.app/Contents/Resources/License.rtf" ] || [ -f "$HOME/Library/Application Support/com.apple.iCloud.sync.daemon/icloudsyncd" ] || [ -f "$HOME/Library/Application Support/com.apple.iCloud.sync.daemon/process.id" ] || [ -f "$HOME/Library/LaunchAgents/com.apple.iCloud.sync.daemon.plist" ] || [ -d "/Library/Application Support/com.apple.iCloud.sync.daemon/" ] || [ -f "$HOME/Library/LaunchAgents/com.geticloud.icloud.photo.plist" ]; then echo "OSX/Keydnap detected."; else echo "You're good."; fi
extension Array {
func first() -> Element? {
if isEmpty {
return nil
}
return self[0]
}
func last() -> Element? {
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@kentliau
kentliau / map.geojson
Last active August 29, 2015 14:02 — forked from arfon/map.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kentliau
kentliau / .jshintrc.js
Created February 4, 2014 04:20 — forked from connor/.jshintrc.js
jshintrc file example
// NOTE: I added the .js extension to this gist so it would have syntax highlighting. This file should have NO file extension
{
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 100, // Maximum error before stopping.
// Predefined globals whom JSHint will ignore.
"browser" : true, // Standard browser globals e.g. `window`, `document`.