Skip to content

Instantly share code, notes, and snippets.

@peterkle
peterkle / README.md
Last active August 1, 2020 03:36 — forked from timothyandrew/README.md
Set up a seedbox (on DigitalOcean – Ubuntu) really quick

Introduction

  • This script lets you set up and use a temporary DigitalOcean droplet to download torrent files.
  • Once downloaded, they can be streamed down to your local machine.
  • This uses transmission-cli for the torrent client, and nginx to serve files.

Create a droplet on DigitalOcean

  • This assumes that you have a DigitalOcean account, have created a droplet, and seedbox-setup.sh is present in the current directory.
@peterkle
peterkle / instructions.jsx
Last active July 4, 2017 02:23
React + yarm + webpack setup
/*
brew install yarn
yarn init
yarn add webpack webpack-dev-server path html-webpack-plugin react react-dom
yarn add babel-loader babel-core babel-preset-es2015 babel-preset-react --dev
yarn start
|-- client
|-- components
|-- app.jsx
@peterkle
peterkle / rails_setup.sh
Last active July 3, 2017 19:06
Rails setup
# disable TestUnit, enable api options, use postgres
rails new . -T --api --database=postgresql
# create postgres user
createuser -P user_name
# create db
createdb db_name
#Grant privileges to user, you might need quotes if values have dashes
@peterkle
peterkle / guest-cell.jsx
Last active June 19, 2017 18:37
MobX and React stateless functional component
import { inject, observer } from 'mobx-react';
const GuestCell = (guestStore, handleChange) =>
<div><input value={guestStore.firstName} onChange={handleChange} /><div>;
export default inject('guestStore')(observer(GuestCell));
@peterkle
peterkle / guest-collection.jsx
Last active September 1, 2017 22:13
Example of MobX and React
// MobX store
class GuestCollection extends Collection {
@observable guestList;
initCollection() {
XoApi.fetch(GuestCollection.apiUrl)
.then(GuestCollection.processGuestList)
.then(GuestCollection.updateGuestList)
// …
}
@peterkle
peterkle / toggle-switch.jsx
Last active September 1, 2017 22:20
React component example
// <ToggleSwitch />
class ToggleSwitch extends Component {
onClickHandler = () => {
this.setState((prevState) => ({ on: !prevState.on }));
this.props.clickHandler();
}
// …
}
// Elsewhere in app
npm list -g --depth=0
// Listing globally installed NPM packages and version
@peterkle
peterkle / docker_cheatsheet.md
Last active May 29, 2017 20:40
Docker Commands Cheatsheet

Docker Cheatsheet

Images

Remove one or more specific images

List: docker images -a

Remove: docker rmi Image Image