Skip to content

Instantly share code, notes, and snippets.

@renzok
renzok / bash_check_required_progs
Created April 17, 2016 21:25
checks if progs are available
function _check_required_programs() {
# Required program(s)
req_progs=(readlink xmllint xsltproc curl date sed)
for p in ${req_progs[@]}; do
hash "${p}" 2>&- || \
{ echo >&2 " Required program \"${p}\" not installed or in search PATH.";
exit 1;
}
@renzok
renzok / latency.markdown
Created February 14, 2016 22:04 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@renzok
renzok / trello-css-guide.md
Created January 6, 2016 23:31 — forked from bobbygrace/trello-css-guide.md
Trello CSS Guide

Trello CSS Guide

“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”

You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?

This is where any fun you might have been having ends. Now it’s time to get serious and talk about rules.

Writing CSS is hard. Even if you know all the intricacies of position and float and overflow and z-index, it’s easy to end up with spaghetti code where you need inline styles, !important rules, unused cruft, and general confusion. This guide provides some architecture for writing CSS so it stays clean and ma

begin;
UPDATE osdregistry.samples
SET nitrate='nan',
nitrite='nan',
ammonium='nan',
phosphate='nan',
silicate='nan'
WHERE submission_id = 215 and osd_id = 117
CREATE MATERIALIZED VIEW osdregistry.sample_boundaries_tagging AS
WITH boundary AS (
SELECT DISTINCT ON (osd.submission_id)
osd.submission_id,
osd.osd_id,
b.gid,
b.iso3_code,
st_distance(osd.start_geog, b.geog) as dist_m
FROM elayers.boundary_polygons b
JOIN osdregistry.samples osd
COPY tara_samples (sample_name, ena_read_no, pangaea_id, publication, type_of_study, seq_method, date_verb, latitude_verb, longitude_verb, depth_verb, feature_verb) FROM STDIN WITH (FORMAT csv, HEADER, DELIMITER E'\t', NULL '', FORCE_NOT_NULL(type_of_study,seq_method) );
sample_name ena_read_no pangaea_id publication type_of_study seq_method date_verb latitude_verb longitude_verb depth_verb feature_verb
TARA_004_DCM_0.22-1.6 ERR598950|ERR599095 TARA_X000000368 sunagawa
BEGIN;
SELECT _v.register_patch('00138-add-boundaries-polygon-table-elayers',
array['00137-osdregistry_new_sample_env_view'] );
-- section of creation best as user role megdb_admin
SET ROLE megdb_admin;
create table elayers.boundary_polygons (
@renzok
renzok / Dockerfile
Last active September 6, 2023 04:55
docker: mapping host uid and gid to user inisde container
FROM debian:jessie
ENV USER=boatswain USER_ID=1000 USER_GID=1000
# now creating user
RUN groupadd --gid "${USER_GID}" "${USER}" && \
useradd \
--uid ${USER_ID} \
--gid ${USER_GID} \
--create-home \
@renzok
renzok / fasta2tsv.awk
Last active October 7, 2015 13:14
fasta to TSV
awk 'BEGIN{RS=">"}NR>1{sub("\n","\t"); gsub("\n",""); print $0}'
@renzok
renzok / sql_array_search
Created May 1, 2015 23:26
sql array based search