Skip to content

Instantly share code, notes, and snippets.

View akhy's full-sized avatar

Akhyar Amarullah akhy

View GitHub Profile
git config --global alias.suck pull
git remote add my url
git branch dick
`git suck my dick` command (almost) ready to use!
@parente
parente / runinenv.sh
Created February 15, 2011 01:54
run a command in virtualenv, useful for supervisord
#!/bin/bash
VENV=$1
if [ -z $VENV ]; then
echo "usage: runinenv [virtualenv_path] CMDS"
exit 1
fi
. ${VENV}/bin/activate
shift 1
echo "Executing $@ in ${VENV}"
exec "$@"
@nstielau
nstielau / send_metric_to_statsd.sh
Created May 11, 2011 16:41
Send a metric to StatsD from bash
# Send a metric to statsd from bash
#
# Useful for:
# deploy scripts (http://codeascraft.etsy.com/2010/12/08/track-every-release/)
# init scripts
# sending metrics via crontab one-liners
# sprinkling in existing bash scripts.
#
# netcat options:
# -w timeout If a connection and stdin are idle for more than timeout seconds, then the connection is silently closed.
@simme
simme / Install_tmux
Created October 19, 2011 07:55
Install and configure tmux on Mac OS X
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/
@tedsparc
tedsparc / bson2json.rb
Created February 8, 2012 00:21
Easily convert a MongoDB BSON file to JSON with Ruby
#!/usr/bin/ruby
# This script acts as a command-line filter to convert a BSON file (such as from mongodump) to an equivalent JSON file
# The resulting JSON file will be an array of hashes
# Any binary values from the BSON file are converted to base64 (such as Mongo's _id fields)
# I originally wrote this script so that Mongo files can be easily used with jsawk for
# offline data processing -- https://github.com/micha/jsawk
#
# To invoke, assuming mycollection.bson is a file from mongodump:
# ruby bson2json.rb < mycollection.bson > mycollection.json

Di sini kita akan membahas seputar pergerakan object di dalam game yang digerakkan dengan cara mengklik titik tujuan kemana object harus bergerak. Cara input seperti ini banyak digunakan untuk game-game RTS dan RPG.

Secara garis besar bisa kita jelaskan sebagai: menggerakkan object ke arah yang dituju. Cukup simpel. Tapi kalo menggampangkan, hasilnya tidak seperti yang kita harapkan; misal, ketika sampai di tujuan, object-nya bergerak bolak-balik.

Semisal object yang akan kita gerakkan berada di posisi A. Kita ingin menggerakkan object ini ke titik B.

Pertama kali, simpan titik tujuan ini, koordinat titik B, sebagai atribute dari sang object.

Langkah selanjutnya kita lakukan adalah mengurangkan koordinat titik tujuan dengan koordinat titik awal. Di sini kita akan mendapatkan (non-normalized) vector dari titik awal ke titik tujuan.

@twosixcode
twosixcode / gist:1988097
Created March 6, 2012 18:40
Make "Paste and Indent" the default paste in Sublime Text 2
// swap the keybindings for paste and paste_and_indent
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" }
@sinewalker
sinewalker / gist:3890869
Created October 15, 2012 04:53
java.vendor id in OpenJDK
[hax]virbuntu$ cat vendor.java
public class vendor {
public static void main(String[] a) {
System.out.println(System.getProperty("java.vendor"));
System.out.println(System.getProperty("java.vendor.url"));
System.out.println(System.getProperty("java.version"));
}
}
[hax]virbuntu$ java -version
java version "1.6.0_24"
@pocmo
pocmo / ViewPagerAdapter.java
Created October 21, 2012 15:02
ViewPagerAdapter: Implementation of PagerAdapter that represents each page as a View
/*
* Copyright (C) 2012 Sebastian Kaspari
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@nodesocket
nodesocket / gist:5023502
Last active December 14, 2015 03:49
## GitHub Commit Message Tricks

GitHub Commit Message Tricks

@username

References a user in a commit message.

@ryah I am working on it.

An issue id

Referene a particular issue by id.