Skip to content

Instantly share code, notes, and snippets.

View greyby's full-sized avatar
☃️
coding

greyby greyby

☃️
coding
View GitHub Profile

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

$PATH in MacOSX 10.7

MacOSX has a truly global path setting that precedes any other setting like ~/.bash_profile. The file /private/etc/paths is a list of pathnames. The order from top to bottom defines the resulting order in the $PATH variable. After loading /private/etc/paths there is a directory /private/etc/paths.d/ with files in the same style. Those are appended to the $PATH variable.

The default content of /private/etc/paths looks like this:

/usr/bin

/bin

@greyby
greyby / application.js
Last active December 7, 2017 13:17
custom ember data's restful URL and modify the HTTP method
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
// namespace: 'api/v2',
host: 'http://localhost:8080',
find: function(store, type, id, snapshot) {
return this.ajax(this.buildURL(type.typeKey, id, snapshot, 'find'), 'GET');
},
@greyby
greyby / 0_reuse_code.js
Created October 28, 2015 07:44
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@greyby
greyby / getParameterByName.js
Created October 29, 2015 16:31
get url parameter by name with javascript
var getParameterByName = function (field, url) {
var href = url ? url : window.location.search;
// replace '[' and ']' character for '\[' and '\]'
field = field.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + field + "=([^&#]*)"),
results = regex.exec(href);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
@greyby
greyby / ObjectHeader32.txt
Created October 17, 2018 03:44 — forked from arturmkrtchyan/ObjectHeader32.txt
Java Object Header
|----------------------------------------------------------------------------------------|--------------------|
| Object Header (64 bits) | State |
|-------------------------------------------------------|--------------------------------|--------------------|
| Mark Word (32 bits) | Klass Word (32 bits) | |
|-------------------------------------------------------|--------------------------------|--------------------|
| identity_hashcode:25 | age:4 | biased_lock:1 | lock:2 | OOP to metadata object | Normal |
|-------------------------------------------------------|--------------------------------|--------------------|
| thread:23 | epoch:2 | age:4 | biased_lock:1 | lock:2 | OOP to metadata object | Biased |
|-------------------------------------------------------|--------------------------------|--------------------|
|
@greyby
greyby / OLTP.md
Last active March 27, 2020 03:03
sysbench usage

Read Only

nohup sysbench --config-file=config oltp_read_only --tables=10 --table-size=10000000 --threads=56 prepare > out1.log 2>&1 &
sysbench --config-file=config oltp_read_only --tables=10 --table-size=10000000 --threads=56 --events=0 --time=300 run > sysbench.log
sysbench --config-file=config oltp_read_only --tables=10 --table-size=10000000 --threads=56 --events=0 --time=300 cleanup

Read and Write