Skip to content

Instantly share code, notes, and snippets.

View cuibonobo's full-sized avatar

Jen Garcia cuibonobo

View GitHub Profile
@cuibonobo
cuibonobo / kivent_app.md
Last active August 29, 2015 14:06
Boilerplate KivEnt application.
// LAN UDP-Broadcast Service Script
// 12-11-2009
// Made by Jordin Kee aka Jordos
// You may use and/or modify this script as you like. Crediting is welcome, but not required.
// Use this at your own risk, I do not guarantee it is bugfree. In fact I do not guarantee anything :)
// This script can be used as a service to perform UDP Broadcasting over a LAN. This is usefull to search for servers on a LAN, without knowing their IP.
// Next, this script is designed for a situation where the player is not able to choose to either start a server, or join one.
// Instead, it is determined by the application (i.e. this script). This, because of the projet I made it for.
// If you don't like this, but still want to use the script, read on...
private var server_port : int = 5000;
private var server_ip : String;
// multicast
private var startup_port : int = 5100;
private var group_address : IPAddress = IPAddress.Parse ("224.0.0.224");
private var udp_client : UdpClient;
private var remote_end : IPEndPoint;
function Start ()
@cuibonobo
cuibonobo / against-human-readable-urls.md
Last active August 29, 2015 14:06
Against human-readable URLs

Human-readable URLs (HRU) allow people to have some sense of what they're getting into before clicking on a link. Many SEO gurus advocate for HRUs because the additional keywords in your URL may have a positive impact on your search rankings. In the midst of the development of PISS I thought long and hard about whether I should include HRUs in my permalink design, but ultimately I decided against it. Here are a few reasons:

  • HRUs make URLs longer and, thus, harder to type because you're introducing characters into an already error-prone process.
  • Social media websites (Figs. 1 & 2) and search engines (Fig. 3) will either truncate or obscure the link, invalidating the human-readable aspect. Even hovering over a link in your browser (Fig. 4) will eventually truncate depending on your screen width.
  • HRUs are fragile because they are normally derived from the name of an article. If the article name ever changes, you will either need to redirect old HRUs to the new o

Add a remote for the repository you'd like to add as a subtree:

git remote add shared ssh://git@bitbucket.org/xyz/shared.git

Create a directory for the subtree and pull it in:

git subtree add --prefix=path/to/code --squash shared master
@cuibonobo
cuibonobo / install-bugs-everywhere.sh
Created January 7, 2015 17:07
Installing Bugs Everywhere on OS X
git clone git://gitorious.org/be/be.git be
cd be
pip install jinja2 cherrypy docutils PyYAML numpydoc sphinx
cp /usr/local/bin/rst2man.py /usr/local/bin/rst2man
make
make install
python setup.py install
@cuibonobo
cuibonobo / resource-centric-rest.md
Last active August 29, 2015 14:15
A resource-centric REST API

I've been working with Eve for about a year now and I've run into a few limitations because of its architecture:

  • Renderers are baked in and hard to update. Eve only provides support for XML and JSON output, so adding a renderer for anything else is pretty difficult. To add an HTML renderer to PISS, I needed to override many internal Eve functions and decorators.
  • The approach is endpoint-centric rather than resource-centric. At first glance it seems like these are the same, but that's not the case: REST-ful APIs should be self-documenting and URI-agnostic. A URI endpoint describes the location of a resource, but it is not the resource itself. In order to discourage hard-coding endpoints client-side, it's best to describe resources and their capabilities while letting endpoints be discoverable by following links from the root URI.
  • There is no flexibility of types for the Accept header. Except to determine whether a document shou
@cuibonobo
cuibonobo / _headless_centos.md
Last active August 29, 2015 14:16
VirtualBox headless CentOS running on Mac OS X on login
  1. Download the CentOS minimal install
  2. Create a new virtual machine and install CentOS on it
  3. Create a new user, add the user to the wheel group, and uncomment the wheel line in visudo
  4. Edit /etc/sysconfig/network-scripts/ifcfg-eth0 so that it looks like the following:
DEVICE=eth0
HWADDR=<Unique system MAC address here -- don't touch>
TYPE=Ethernet
UUID=<Unique universal identifier here -- don't touch>
ONBOOT=yes
@cuibonobo
cuibonobo / centos_python_install.md
Last active April 30, 2024 13:13
Install Python 2.7.15 on CentOS 6

These instructions were mostly taken from here, though I've modified them to install Python 2.7.15 and the latest setuptools package.

# Install dependencies
yum groupinstall -y 'development tools'
yum install -y zlib-devel bzip2-devel openssl-devel xz-libs wget

# Download the Python source and unpack it
wget https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz
tar -xvzf Python-2.7.15.tgz
@cuibonobo
cuibonobo / nginx_git.md
Created March 13, 2015 23:12
Make git repos available over Nginx

Add the following to your nginx.conf:

location ~ /git(/.*) {
    alias /path/to/repositories/$1;
}

On the repositories in /path/to/repositories/ that you'd like to share, cd into them and do: