Skip to content

Instantly share code, notes, and snippets.

View indiejoseph's full-sized avatar
🏠
Working from home

Joseph Cheng indiejoseph

🏠
Working from home
View GitHub Profile
@motephyr
motephyr / .jsx
Created March 13, 2016 15:14
AuthenticateComponent
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import { pushPath } from 'redux-simple-router';
export function requireAuthentication(Component) {
class AuthenticateComponent extends React.Component {
constructor(props) {
super(props);
}
@erikbern
erikbern / install-tensorflow.sh
Last active June 26, 2023 00:40
Installing TensorFlow on EC2
# Note – this is not a bash script (some of the steps require reboot)
# I named it .sh just so Github does correct syntax highlighting.
#
# This is also available as an AMI in us-east-1 (virginia): ami-cf5028a5
#
# The CUDA part is mostly based on this excellent blog post:
# http://tleyden.github.io/blog/2014/10/25/cuda-6-dot-5-on-aws-gpu-instance-running-ubuntu-14-dot-04/
# Install various packages
sudo apt-get update
@pospi
pospi / init-private-npm-modules.sh
Last active October 10, 2016 06:34
Sets up NPM module linkage when using private modules from your own registry
#!/usr/bin/env bash
#
# Helper script to setup symlinks and modules for services integration during development
#
# @depends http://stedolan.github.io/jq/
#
# :WARNING:
# Your global npm packages must be installed for the current user in order for this script to work.
# If this is not the case, we recommend you nuke your global npm folder and replace with an nvm-managed
# node install in your homedir, which will have the correct permissions for `npm link` to function.
@oscarrenalias
oscarrenalias / README.md
Last active September 27, 2020 18:46
Docker service discovery with HAproxy, consul and registrator on Docker Machine and Docker Swarm
BM25.stopwods = ['a', 'about', 'above', 'across', 'after', 'afterwards', 'again', 'against', 'all', 'almost', 'alone', 'along', 'already', 'also', 'although', 'always', 'am', 'among', 'amongst', 'amoungst', 'amount', 'an', 'and', 'another', 'any', 'anyhow', 'anyone', 'anything', 'anyway', 'anywhere', 'are', 'around', 'as', 'at', 'back', 'be', 'became', 'because', 'become', 'becomes', 'becoming', 'been', 'before', 'beforehand', 'behind', 'being', 'below', 'beside', 'besides', 'between', 'beyond', 'bill', 'both', 'bottom', 'but', 'by', 'call', 'can', 'cannot', 'cant', 'co', 'computer', 'con', 'could', 'couldnt', 'cry', 'de', 'describe', 'detail', 'do', 'done', 'down', 'due', 'during', 'each', 'eg', 'eight', 'either', 'eleven', 'else', 'elsewhere', 'empty', 'enough', 'etc', 'even', 'ever', 'every', 'everyone', 'everything', 'everywhere', 'except', 'few', 'fifteen', 'fify', 'fill', 'find', 'fire', 'first', 'five', 'for', 'former', 'formerly', 'forty', 'found', 'four', 'from', 'front', 'full', 'further', 'get', 'g
@six519
six519 / test_hook.py
Last active September 13, 2021 01:05
Sending Bitbucket POST Hook To Slack Incoming Webhooks (Python Code)
#!/usr/bin/env python
"""
Python Module Depedencies:
==========================
falcon
requests
"""
import falcon
import json
import requests
@sebmarkbage
sebmarkbage / ElementFactoriesAndJSX.md
Last active May 17, 2022 11:06
New React Element Factories and JSX

New React Element Factories and JSX

In React 0.12, we're making a core change to how React.createClass(...) and JSX works.

If you're using JSX in the typical way for all (and only) React components, then this transition will be seamless. Otherwise there are some minor breaking changes described below.

The Problem

@higepon
higepon / API.swift
Last active July 31, 2023 16:00
An example of JSON API call in Swift
//
// API.swift
//
// Created by Taro Minowa on 6/10/14.
// Copyright (c) 2014 Higepon Taro Minowa. All rights reserved.
//
import Foundation
typealias JSONDictionary = Dictionary<String, AnyObject>
@unverbraucht
unverbraucht / gist:118117ab66ac142f4eda
Last active January 24, 2023 18:16
Script for OpenWRT that adds delay, bandwidth limiting and packet loss to a Wi-Fi router connection. See http://kevin-read.com/post/86601925386/simulating-a-slow-network-connection-when-testing-on for details
#!/bin/sh
# The bandwidth to simulate, here about 56kilobit per second. This is layer 2 bandwidth, so TCP/UDP and IP overhead will apply
BW="56kbps"
# _Half_ the latency that we aim for. Since this applies to both the WAN port and Wi-Fi, the delay is applied twice, so this actually puts it at around 120+ms
LATENCY="60ms"
# Chance of packet loss. Also applied to both interfaces, so it is 1%.
LOSS="0.5%"
# The device name of your wifi device.
WIFI="wlan0"
@ruzickap
ruzickap / openwrt_transmission.sh
Last active May 8, 2024 16:04
OpenWrt Transmission
opkg install transmission-remote transmission-web
mkdir -p /data/torrents/torrents-completed /data/torrents/torrents-incomplete /data/torrents/torrents /data/torrents/config
uci set transmission.@transmission[-1].enabled=1
uci set transmission.@transmission[-1].config_dir=/data/torrents/config
uci set transmission.@transmission[-1].download_dir=/data/torrents/torrents-completed
uci set transmission.@transmission[-1].incomplete_dir_enabled=true
uci set transmission.@transmission[-1].incomplete_dir=/data/torrents/torrents-incomplete
uci set transmission.@transmission[-1].blocklist_enabled=1