Skip to content

Instantly share code, notes, and snippets.

View xyhp915's full-sized avatar
๐Ÿ˜‡
monadic life ...

Charlie xyhp915

๐Ÿ˜‡
monadic life ...
View GitHub Profile
@xyhp915
xyhp915 / sublime-command-line.md
Created July 28, 2017 07:58 — forked from adrianorsouza/sublime-command-line.md
launch sublime text from the command line

Launch Sublime Text from the command line on OSX

Sublime Text includes a command line tool, subl, to work with files on the command line. This can be used to open files and projects in Sublime Text, as well working as an EDITOR for unix tools, such as git and subversion.

Requirements

  • Sublime text 2 or 3 installed in your system within Applications folder

Setup

@xyhp915
xyhp915 / howto-setup-transparent-proxied-router.md
Created June 29, 2017 06:48 — forked from snakevil/howto-setup-transparent-proxied-router.md
ๅฆ‚ไฝ•ๅœจ่ทฏ็”ฑๅ™จไธญๅฎž็Žฐ้€ๆ˜Žไปฃ็†๏ผŸ

ๅฆ‚ไฝ•ๅœจ่ทฏ็”ฑๅ™จไธญๅฎž็Žฐ้€ๆ˜Žไปฃ็†๏ผŸ

0 ไบ’่”็ฝ‘็Žฐ็Šถ

็›ฎๅ‰ๆ•ดไธชไบ’่”็ฝ‘็Žฏๅขƒ๏ผŒ่ขซ็ ดๅๆœ€ไธฅ้‡ๅœฐ้ƒจๅˆ†๏ผŒๆ˜ฏ Web ๆœๅŠกไฝ“้ชŒใ€‚ๅฝ“็›ดๆŽฅ็ ดๅ้šพไปฅๅฎž็Žฐๆ—ถ๏ผŒๅฐฑไผšไปŽๆต็จ‹้“พ็š„ไธŠไธ‹ๆธธ็€ๆ‰‹๏ผŒๅฆ‚๏ผšDNS ๆฑกๆŸ“ใ€‚

ๅ…ถๅฎƒๅœฐไบ’่”็ฝ‘ๆœๅŠก็ฑปๅž‹๏ผŒไพ‹ๅฆ‚๏ผš้‚ฎไปถ๏ผŒๅฏ่ƒฝๅฐ้ƒจๅˆ†ไผšๅ—ๅˆฐ Web ๆœๅŠกไธŠไธ‹ๆธธ็ ดๅๅœฐไฝ™้œ‡๏ผŒไฝ†ๆ•ดไฝ“ไธŠๅŸบๆœฌไธๅ—ๅฝฑๅ“ใ€‚

@xyhp915
xyhp915 / Ramda-pipe.js
Created April 6, 2017 03:55 — forked from dtipson/Ramda-pipe.js
Piping for Promises
let pipePromise = R.reduce( (p,fn) => p.then(fn) );
@xyhp915
xyhp915 / example.scss
Created December 2, 2016 03:55 — forked from wilkerlucio/example.scss
Compass sprite resize mixin
$my-icons-spacing: 10px; // give some space to avoid little pixel size issues on resize
@import "my-icons/*.png";
$my-icons-sprite-dimensions: true;
@include all-my-icons-sprites;
// the fun part
@xyhp915
xyhp915 / Fabric-Setup.md
Created November 16, 2016 09:56 — forked from junaid18183/Fabric-Setup.md
Fabric-Setup

A Brief Introduction to Fabric

Fabric is a deployment management framework written in Python which makes remotely managing multiple servers incredibly easy. If you've ever had to issue a change to a group servers, this should look pretty familiar:

for s in $(cat servers.txt); do ssh $s service httpd graceful; done

Fabric improves on this process by providing a suite of functions to run commands on the servers, as well as a number of other features which just aren't possible in a simple for loop. While a working knowledge of Python is helpful when using Fabric, it certainly isn't necessary. This tutorial will cover the steps necessary to get started with the framework and introduce how it can be used to improve on administering groups of servers.

@xyhp915
xyhp915 / onchange.sh
Created November 15, 2016 02:49 — forked from senko/onchange.sh
Watch current directory and execute a command if anything in it changes
#!/bin/bash
#
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
#
# Written by: Senko Rasic <[email protected]>
#
# Requires Linux, bash and inotifywait (from inotify-tools package).
#
# To avoid executing the command multiple times when a sequence of
@xyhp915
xyhp915 / README.md
Created November 10, 2016 06:04 — forked from balupton/README.md
Installing ChromiumOS

Install ChromiumOS

  1. Get Chromium OS from one of the following places
    1. Download the vanilla build (old but stable): http://chromeos.hexxeh.net/
      1. NOTE: Password is facepunch
    2. Download the nightly build (sync doesn't work): http://download-chromiumos.appspot.com/
      1. NOTE: If you want developer mode, you must change _base_ in the download URL to _test_ as the base image does not have developer tools enabled
      2. NOTE: Password is unknown, instructions for working around this are provided later
      3. NOTE: I could not get syncing working with this build, perhaps due to no API KEYS being provided???
  2. NOTE: I could not move past the welcome screen on the 64bit build due to no network being found (32bit worked)
@xyhp915
xyhp915 / KotlinParcelable.kt
Last active November 7, 2016 05:03 — forked from juanchosaravia/KotlinParcelable
How to use Parcelable in Kotlin v1.0.0-beta-4589
// ------------ Helper extension functions:
// Inline function to create Parcel Creator
inline fun <reified T : Parcelable> createParcel(crossinline createFromParcel: (Parcel) -> T?): Parcelable.Creator<T> =
object : Parcelable.Creator<T> {
override fun createFromParcel(source: Parcel): T? = createFromParcel(source)
override fun newArray(size: Int): Array<out T?> = arrayOfNulls(size)
}
// custom readParcelable to avoid reflection
@xyhp915
xyhp915 / cors.nginxconf
Created October 22, 2016 15:33 — forked from pauloricardomg/cors.nginxconf
Nginx configuration for CORS-enabled HTTPS proxy with origin white-list defined by a simple regex
#
# Acts as a nginx HTTPS proxy server
# enabling CORS only to domains matched by regex
# /https?://.*\.mckinsey\.com(:[0-9]+)?)/
#
# Based on:
# * http://blog.themillhousegroup.com/2013/05/nginx-as-cors-enabled-https-proxy.html
# * http://enable-cors.org/server_nginx.html
#
server {
@xyhp915
xyhp915 / cors-nginx.conf
Last active October 21, 2016 07:12 — forked from alexjs/cors-nginx.conf
Slightly tighter CORS config for nginx
#
# Slightly tighter CORS config for nginx
#
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs
#
# Despite the W3C guidance suggesting that a list of origins can be passed as part of
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox)
# don't seem to play nicely with this.
#