Skip to content

Instantly share code, notes, and snippets.

View aergonaut's full-sized avatar

Chris Fung aergonaut

View GitHub Profile

How to use

cd /etc/init.d
curl $RAW_GIST_URL -o minecraft
chmod a+x minecraft

Make sure to edit the script and change the configuration variables at the top to match your system.

@hamin
hamin / example.rb
Last active August 29, 2015 14:26
An updated Rust 1.x version of Yehuda's Native Rust Extension post here http://blog.skylight.io/bending-the-curve-writing-safe-fast-native-gems-with-rust/
require "./points"
p1 = RustPoint::make_point(10, 10) # => #<Fiddle::Pointer:0x007f8231e56510 ptr=0x0000010b824000 size=0 free=0x00000000000000>
p2 = RustPoint::make_point(20, 20) # => #<Fiddle::Pointer:0x007f8231f20970 ptr=0x0000010b824010 size=0 free=0x00000000000000>
RustPoint::get_distance(p1, p2) # => 14.142135623730951
config = Rails::Configuration.new
database = config.database_configuration[RAILS_ENV]["database"]
username = config.database_configuration[RAILS_ENV]["username"]
password = config.database_configuration[RAILS_ENV]["password"]
namespace :db do
#rake db:dump
desc "dumps the database to a sql file"
task :dump => :environment do

A small sampling of external projects initially built for Ember use but designed to be used standalone:

@edjames
edjames / db.rake
Created January 23, 2012 14:16
Rake tasks for MySQL data import/export
namespace :db do
namespace :data do
desc "Dump data into sql script file: filename=[target filename]"
task :dump => 'environment' do
environment = (ENV.include?("RAILS_ENV")) ? (ENV["RAILS_ENV"]) : 'development'
ENV["RAILS_ENV"] = RAILS_ENV = environment
database = get_database(environment)
user = database
password = ENV['PASSWORD']
@rosskevin
rosskevin / relay.js
Last active June 27, 2018 01:07
flow libdef for relay modern 1.2. This is in a _works for me_ state. Someone please export these properly from relay or create a proper flow-typed libdef.
// @flow
declare module 'react-relay' {
declare export type RecordState = 'EXISTENT' | 'NONEXISTENT' | 'UNKNOWN';
declare export type onCompleted = (response: ?Object, errors: ?Array<PayloadError>) => void
declare export type onError = (error: Error) => void
declare export type CommitOptions = {
onCompleted: onCompleted,
@rattrayalex
rattrayalex / MessageStore_FluxBone.js
Last active June 19, 2020 09:40
Flux and Backbone
var ChatAppDispatcher = require('../dispatcher/ChatAppDispatcher');
var ChatConstants = require('../constants/ChatConstants');
var ChatMessageUtils = require('../utils/ChatMessageUtils');
var EventEmitter = require('events').EventEmitter;
var ThreadStore = require('../stores/ThreadStore');
var merge = require('react/lib/merge');
var ActionTypes = ChatConstants.ActionTypes;
var CHANGE_EVENT = 'change';
# typed: true
# frozen_string_literal: true
require('dev')
require('fileutils')
module Dev
module Helpers
class APFSVolume
extend(T::Sig)
@atmos
atmos / heaven.md
Last active November 23, 2020 22:35
Response to a dude who asked about heaven. https://github.com/holman/feedback/issues/422

@holman got a request about our deployment system, heaven

I know it's not a high priority, but has there been any activity on open-sourcing the core Heaven gem?

There is. I've been working on extracting the non-GitHub specific parts into two gems. This first is a CLI portion called hades. The second is an HTTP API portion called heaven.

When you open source something previously used as in internal tool like Heaven, Hubot, Boxen, etc., how do you manage and hook in the parts that need to stay internal?

Normally I focus around four questions:

@Vazkii
Vazkii / Message.java
Last active March 8, 2021 20:37
Plug'n'Play Packet System
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Psi Mod. Get the Source Code in github:
* https://github.com/Vazkii/Psi
*
* Psi is Open Source and distributed under the
* CC-BY-NC-SA 3.0 License: https://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB
*
* File Created @ [11/01/2016, 22:00:30 (GMT)]
*/