Skip to content

Instantly share code, notes, and snippets.

View hyamamoto's full-sized avatar

Hiroshi Yamamoto hyamamoto

View GitHub Profile
@mpasternacki
mpasternacki / docker-compile.pl
Last active March 23, 2020 14:05
Perl script to build a Docker image from Dockerfile that creates the image in a single layer, without any intermediate images. Needs JSON CPAN module (available as `libjson-perl` Debian/Ubuntu package). Usage: run the script in the directory that contains a Dockerfile. More details in a blog post: http://3ofcoins.net/2013/09/22/flat-docker-images/
#!/usr/bin/env perl
use feature 'switch';
use strict;
use warnings;
use Data::Dumper;
use File::Basename;
use File::Copy;
use File::Path qw/make_path/;
@alex-lawson
alex-lawson / gist:8014884
Last active December 31, 2015 16:39
Bonus patch notes for modders

Lua API / Modding Changes

  • The object table accessible from object scripts has been renamed to entity for consistency
  • Object scripts receive an argument in init which is true when the object is being previewed and false when it is placed in the world
  • Wire objects can now use getInboundNodeIds(nodeIndex) and getOutboundNodeIds(nodeIndex) to get a table of entityIds for all objects connected to the specified wire node
  • Object scripts can now define a function die() to be called when the object is broken or destroyed
  • Added an entityProxy wrapper function to make more entity functions available (details here: https://www.irccloud.com/pastebin/ZQBDj4ou)
  • Added entity.setDropPool for monsters to allow changing their dropPool parameter from scripts, which can also be set to nil to disable drops
  • Added world.damageTiles and world.placeMaterial for tile manipulation
@sugimotoak
sugimotoak / AnimationScript.cs
Created December 22, 2013 16:43
Unity+OculusRift+LeapMotionで3Dキャラクターに触れる ref: http://qiita.com/sugimotoak/items/1d3574a5a084d0c349cd
using UnityEngine;
using System.Collections;
public class AnimationScript : MonoBehaviour {
public GameObject miku = null;
private Animation mikuAnime;
// Use this for initialization
void Start () {
@agleyzer
agleyzer / akamai2graphite.py
Created January 29, 2014 21:30
Bulk loader for Akamai traffic reports CSV to Graphite
#!/usr/bin/env python
import socket
from datetime import datetime
import csv
import sys
import pickle
import struct
import threading
import urllib2
/*!
* jQuery JavaScript Library v2.1.1pre
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
@kazuph
kazuph / .gitignore
Last active November 24, 2015 03:06
Backlog記法で書かれたWikiをMarkdownのプロジェクトのWikiに全面自動移行するスクリプト ref: http://qiita.com/kazuph/items/57103dde7f4e4a0c4ff1
# Created by https://www.gitignore.io/api/vim,ruby
### Vim ###
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~
function isotonic_regression(y::Vector{Float64}, weights::Vector{Float64})
@inbounds begin
n = size(y, 1)
if n <= 1
return y
end
n -= 1
while true
i = 1
pooled = 0
#include <memory>
#include <random>
#include <chrono>
#include <algorithm>
#include <iostream>
#include <gflags/gflags.h>
#include <boost/chrono/chrono.hpp>
#include <boost/chrono/duration.hpp>
#include <boost/chrono/process_cpu_clocks.hpp>
@ptantiku
ptantiku / emolist.js
Created March 31, 2014 16:02
Javascript to print out all emoticons on Facebook. Usage: open javascript console on the browser (e.x. ctrl+shift+j) then paste the code in.
var emolist=[
{"chars" : " :) ", "class" : "emoticon_smile", "name" : "Smiley"},
{"chars" : " :( ", "class" : "emoticon_frown", "name" : "Frown"},
{"chars" : " :P ", "class" : "emoticon_tongue", "name" : "Tongue"},
{"chars" : " :D ", "class" : "emoticon_grin", "name" : "Grin"},
{"chars" : " :o ", "class" : "emoticon_gasp", "name" : "Gasp"},
{"chars" : " ;) ", "class" : "emoticon_wink", "name" : "Wink"},
{"chars" : " :v ", "class" : "emoticon_pacman", "name" : "Pacman"},
{"chars" : " >:( ", "class" : "emoticon_grumpy", "name" : "Gruñón"},
{"chars" : " :/ ", "class" : "emoticon_unsure", "name" : "Unsure"},
@alex-lawson
alex-lawson / notes.md
Last active August 29, 2015 13:58
Notes for Modders - Starbound unstable update April 8, 2014
  • New function world.tileIsOccupied(tile, tileLayer, includeEphemeral)
    • tile (vec2) the position to check
    • tileLayer (boolean, optional, default=true) the tile layer to check (true for foreground, false for background)
    • includeEphemeral (boolean, optional, default=false) include held but unplaced objects such as a player's object placement preview
    • returns true when the specified tile position contains a material or a placed object
  • New function world.farmableStage(entityId) returns the current growth stage of the specified farmable object as an integer, or nil if the object is not a valid farmable
  • Added entity.applyMovementParameters and entity.applyMovementModifiers to monster context, with functionality similar to the tech functions of the same name
  • Objects will now retain their storage table when broken into items
  • Container objects can now specify a hook to be called when the inventory is changed (by players or scripts).