Skip to content

Instantly share code, notes, and snippets.

View constantine-nikolaou's full-sized avatar

Constantine Nikolaou constantine-nikolaou

View GitHub Profile
@constantine-nikolaou
constantine-nikolaou / uber.yaml
Created April 5, 2021 13:39 — forked from earth2marsh/uber.yaml
A Swagger YAML specification for Uber's new API
swagger: 2
info:
title: The new Uber API
description: Move your app forward with the Uber API
version: "1.0.0"
host: api.uber.com
schemes:
- https
basePath: /v1
produces:
@constantine-nikolaou
constantine-nikolaou / .bash_profile
Last active May 30, 2018 09:35 — forked from hernamesbarbara/.bash_profile
bash_profile minimised to use on *NIX based machines, with terminal colors and useful aliases
#!/bin/bash
export TERM=xterm-color
export CLICOLOR=1
export GREP_OPTIONS='--color=auto'
# export LSCOLORS=Exfxcxdxbxegedabagacad
export LSCOLORS=gxfxcxdxbxegedabagacad # Dark lscolor scheme
# Don't put duplicate lines in your bash history
export HISTCONTROL=ignoredups
# increase history limit (100KB or 5K entries)
export HISTFILESIZE=100000
@constantine-nikolaou
constantine-nikolaou / url62.py
Created February 19, 2018 19:43 — forked from mattupstate/url62.py
python url62 implementation
import string
import uuid
alphabet = string.digits + string.ascii_letters
def base62_encode(n):
ret = ''
while n > 0:
ret = alphabet[n % 62] + ret
n /= 62

Principles of Adult Behavior

  1. Be patient. No matter what.
  2. Don’t badmouth: Assign responsibility, not blame. Say nothing of another you wouldn’t say to him.
  3. Never assume the motives of others are, to them, less noble than yours are to you.
  4. Expand your sense of the possible.
  5. Don’t trouble yourself with matters you truly cannot change.
  6. Expect no more of anyone than you can deliver yourself.
  7. Tolerate ambiguity.
  8. Laugh at yourself frequently.
@constantine-nikolaou
constantine-nikolaou / iterm2.md
Created October 5, 2017 09:46 — forked from squarism/iterm2.md
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
Fullscreen + Enter
Previous Tab + Left Arrow
Next Tab + Right Arrow
Go to Tab + Number
Go to Window + Option + Number
Go to Split Pane by Direction + Option + Arrow
class UpgradeToRefineryTwo < ActiveRecord::Migration
def self.up
# For refinerycms-authentication
rename_table :roles_users, :refinery_roles_users
rename_table :roles, :refinery_roles
rename_table :user_plugins, :refinery_user_plugins
rename_table :users, :refinery_users
remove_column :refinery_users, :persistence_token
remove_column :refinery_users, :perishable_token
remove_column :refinery_users, :remember_token
@constantine-nikolaou
constantine-nikolaou / setup-statsd.sh
Created September 9, 2012 15:08 — forked from collegeman/setup-statsd.sh
Turn an Ubuntu 10.04 linode into a StatsD/Graphite server
# install git
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
# download the Node source, compile and install it
git clone https://github.com/joyent/node.git
cd node
./configure
make
sudo make install
# install the Node package manager for later use

Here's how to install PostgreSQL and have it run automatically at startup, on an Ubuntu 10.04 virtual machine using Vagrant. This took me a while to figure out:

Add the default lucid32 base box to your vagrant, if you haven't already:

host> vagrant box add lucid32 http://files.vagrantup.com/lucid32.box 

Now make a new lucid32 virtual machine and install postgresql on it:

@constantine-nikolaou
constantine-nikolaou / super_simple_sqs.rb
Created October 26, 2011 13:15 — forked from ssimeonov/super_simple_sqs.rb
This is a simple way to post a message to Amazon SQS w/o any gems (the queue must already exist)
module Amazon
module Authentication
SIGNATURE_VERSION = "2"
@@digest = OpenSSL::Digest::Digest.new("sha256")
def sign(auth_string)
Base64.encode64(OpenSSL::HMAC.digest(digester, aws_secret_access_key, auth_string)).strip
end
def digester
@constantine-nikolaou
constantine-nikolaou / compress_requests.rb
Created August 5, 2011 11:42 — forked from subdigital/compress_requests.rb
Rack Middleware to automatically unzip gzipped/deflated POST data
class CompressedRequests
def initialize(app)
@app = app
end
def call(env)
if env['REQUEST_METHOD'] =~ /(POST|PUT)/
if env.keys.include? 'HTTP_CONTENT_ENCODING'
input = env['rack.input'].read