Map [1]
Operation | Time Complexity |
---|---|
Access | O(log n) |
Search | O(log n) |
Insertion | O(n) for < 32 elements, O(log n) for >= 32 elements [2] |
Deletion | O(n) for < 32 elements, O(log n) for >= 32 elements |
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
" VIM Configuration - Vincent Jousse | |
" Cancel the compatibility with Vi. Essential if you want | |
" to enjoy the features of Vim | |
set nocompatible | |
" Activate pathogen | |
call pathogen#infect() | |
" -- Display | |
set title " Update the title of your window or your terminal |
defmodule ChangeMaker do | |
@denominations [ | |
10000, | |
5000, | |
2000, | |
1000, | |
500, | |
200, | |
100, | |
25, |
import asyncio | |
import vobject | |
import os | |
import json | |
import_dir = os.path.dirname(__file__) | |
rel_path = "contacts.vcf" | |
abs_file_path = os.path.join(import_dir, rel_path) | |
f = open(abs_file_path) |
FROM ubuntu:14.04 | |
RUN apt-get update && apt-get install -y curl git locales | |
RUN locale-gen en_US.UTF-8 | |
ENV LANG=en_US.UTF-8 | |
ENV LANGUAGE en_US:en | |
ENV LC_ALL en_US.UTF-8 | |
RUN apt-get -y update && \ |
I started with Elixir just a couple weeks after the switch from 1.4 to 1.5, so the bulk of online resources were out of date (or at least resulted in deprecation warnings). This guide is for defining Elixir 1.5 supervised modules.
It's not actually terribly complicated. It's just sometimes unclear from examples what's implemented by the language and what you actually have to implement yourself.
Say we want a supervision tree like this (where each atom is a process):
:a
/ \
" This vimrc is "inspired" by @moonglum, @garybernhardt and @railsbros-dirk | |
" Thanks to all of you for letting me steal your stuff :) | |
" Activate Syntax Highlight | |
set hlsearch | |
" Incremental search, search as you type | |
set incsearch | |
" Ignore case when searching | |
set ignorecase smartcase | |
" Ignore case when searching lowercase |
// MySQL to Google Spreadsheet By Pradeep Bheron | |
// Support and contact at pradeepbheron.com | |
function myMySQLFetchData() { | |
var conn = Jdbc.getConnection('jdbc:mysql://127.0.0.1:3306/employee_db', 'username', 'pass'); // Change it as per your database credentials | |
var stmt = conn.createStatement(); | |
var start = new Date(); // Get script starting time | |
// https://jsbin.com/wakubofuvo/edit?js,console | |
var arr = [2012, 2011, 2010, 2008, 2002]; | |
var tmp = []; | |
_.forEach(arr, function (e, i) { | |
if(e - arr[i + 1] > 1) { | |
var range = e - (arr[i + 1] + 1); //in between | |
while(range > 0) { | |
tmp.push({year: +(e - range)}); | |
--range; |