Skip to content

Instantly share code, notes, and snippets.

View niftynei's full-sized avatar
🧡
on sabbatical

neil saitug niftynei

🧡
on sabbatical
View GitHub Profile
@niftynei
niftynei / graphite_.sh
Last active September 25, 2015 19:21
Setting up Graphite on an EC2 instance
# ~~Caveat Emptor~~
# This is a rough approximation of the steps I used to setup graphite on an Amazon EC2 instance
# No guarantees that it works. Also note that since you'll pulling graphite from source, there's a good possibility
# that the setup instructions have changed.
## Due diligence: many thanks are owed to the following tutorials & docs:
# https://www.digitalocean.com/community/tutorials/installing-and-configuring-graphite-and-statsd-on-an-ubuntu-12-04-vps
# https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-centos-7
# http://graphite.readthedocs.org/en/latest/releases/0_10_0.html
# https://timsvirtualworld.com/2013/05/how-to-install-graphite-on-amazon-linux/
@niftynei
niftynei / brew --config
Created June 5, 2012 16:46
Homebrew Error with Gnu-prolog Install
HOMEBREW_VERSION: 0.9
HEAD: (none)
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit sandybridge
OS X: 10.7.4
Kernel Architecture: x86_64
Xcode: 4.3.2
GCC-4.0: N/A
GCC-4.2: build 5658
@niftynei
niftynei / mergesort.c
Created August 3, 2012 19:52
Mergesort in C!
#include <stdlib.h>
#include <stdio.h>
int* merge_sort(int* ,int, int);
void merge(int*, int, int, int, int);
int main(void) {
int *return_array_ptr;
@niftynei
niftynei / gist:5bfdcd285b598ec16189
Created October 19, 2015 21:26
Django Deploy Steps
0. # make a snapshot of prod in EC2. jic.
1. # rsync your file from staging
2. sudo django-admin.py collectstatic -v0 --noinput
3. sudo django-admin.py syncdb
4. sudo vim webapp/graphite/local_settings.py ## TODO: move stuff to env vars
5. sudo apachectl -k stop
6. sudo apachectl -k start
7. # delete your snapshot
public class CreateUserRequest extends NetworkRequest<User> {
// ...
@Override
public User onMakeRequest() {
String bearerString = ClientAuthManager.get().createBearerString();
// Make a request to create a user object.
User user = EoApp.getAppContext().getClientRequestManager().getAuthApiService().createUser(bearerString, mNewUser);
@niftynei
niftynei / gist:0dca2b1a0151788f4ecc
Last active December 17, 2015 18:35
sample catch block
public <ReturnType> NetworkRequest<ReturnType> makeRequest(NetworkRequest<ReturnType> request) {
try {
request.makeRequest();
// if you reach this, request succeeded!
request.setStatus(HttpURLConnection.HTTP_OK, NetworkRequest.Status.SUCCESS);
return request;
} catch (RetrofitError error) {
Response errorResponse = error.getResponse();
public <ReturnType> EoNetworkRequest<ReturnType> makeRequest(EoNetworkRequest<ReturnType> request) {
try {
retrofit.Response<ReturnType> response = request.makeRequest();
if (response.isSuccess()) {
return request;
} else {
// todo: parse the error body into some sort of usable structure. or something??
}
} catch (IOException e) { // network error
public class CreateUserRequest extends ClientNetworkRequest<User, Object> {
// ...
@Override
public NetworkCallResponse<Object> onMakeRequest() throws IOException {
EoLog.d(TAG, "Register a user called");
String bearerString = ClientAuthManager.get().createBearerString();
retrofit.Response<User> userResponse = EoApp.getAppContext()
.getClientRequestManager()
package com.electricobjects.client.onboarding;
import android.app.Dialog;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.content.ContextCompat;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@niftynei
niftynei / shell_intro.md
Created April 13, 2016 19:12
intro to shell, a script

what is a shell?

Shell is a programming environment that terminal runs. it's a text based GUI for interacting with your system.

what is shell good for?

shell can give you information about your system, allows you to modify and run programs. let's try something

say "hello lisa"