Skip to content

Instantly share code, notes, and snippets.

View randito's full-sized avatar
:octocat:
(⊙_⊙)

Randy Pond randito

:octocat:
(⊙_⊙)
View GitHub Profile
@randito
randito / phx_sqlite_fly_launch.md
Created January 1, 2023 22:11 — forked from mcrumm/phx_sqlite_fly_launch.md
Phoenix + SQLite Deployment tips

Deploying to Fly.io with SQLite

Deploying a Phoenix app to Fly.io is a breeze...is what everyone kept telling me. In fairness, I imagine the process would have been breezier had I just used postgres, but all the sqlite and litestream talk has been far too intriguing to ignore. "Wait", you say. "It is just a flat file. How much harder can it be?"

It is easy to make something harder than it should be. It is hard to take something complex and make it truly simple. flyctl launch does an amazing job at providing a simple interface to the utterly complex task of generating deployment resources, especially now that we are living in a containerd (erm, firecracker) world.

This gist is for anyone who, like me, thinks they know better than to read all of the documentation and therefore necessari

@randito
randito / setup.sh
Created November 30, 2020 16:31 — forked from Gazler/setup.sh
sysctl -w fs.file-max=12000500
sysctl -w fs.nr_open=20000500
ulimit -n 4000000
sysctl -w net.ipv4.tcp_mem='10000000 10000000 10000000'
sysctl -w net.ipv4.tcp_rmem='1024 4096 16384'
sysctl -w net.ipv4.tcp_wmem='1024 4096 16384'
sysctl -w net.core.rmem_max=16384
sysctl -w net.core.wmem_max=16384
wget http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
sudo dpkg -i erlang-solutions_1.0_all.deb
@randito
randito / Dockerfile
Created March 4, 2020 17:26 — forked from juanpabloaj/Dockerfile
elixir and phoenixframework with docker-compose
FROM elixir:slim
# install Node.js (>= 8.0.0) and NPM in order to satisfy brunch.io dependencies
# See https://hexdocs.pm/phoenix/installation.html#node-js-5-0-0
RUN apt-get update -y && \
apt-get install -y curl git && \
curl -sL https://deb.nodesource.com/setup_13.x | bash - && \
apt-get install -y inotify-tools nodejs
WORKDIR /code
@randito
randito / latency.txt
Created February 17, 2019 01:56 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@randito
randito / gist:3724898
Created September 14, 2012 21:16 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@randito
randito / gist:2997311
Created June 26, 2012 17:36 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
#! /usr/bin/env ruby
# Generate all tags for all gems included by bundler in gems.tags
#
# Basically does the same as "bundle show gemname", except for all gems.
# Interestingly enough, "bundle show" without any arguments falls back to
# "bundle list", otherwise the whole thing could have been a bash one-liner.
require 'bundler'
@randito
randito / installation.sh
Created December 21, 2011 01:59 — forked from mikhailov/installation.sh
Nginx+passenger application config: ssl redirection, http headers, passenger optimal settings. see details: http://mikhailov.posterous.com/nginx
$ cd /usr/src
$ wget http://nginx.org/download/nginx-0.8.52.tar.gz
$ tar xzvf ./nginx-0.8.52.tar.gz
$ rm ./nginx-0.8.52.tar.gz
$ gem install s3sync capistrano capistrano-ext passenger --no-ri --no-rdoc
$ passenger-install-nginx-module
# Automatically download and install Nginx? 2. No: I want to customize my Nginx installation
# Where is your Nginx source code located?: /usr/src/nginx-0.8.52
# Where do you want to install Nginx to?: /opt/nginx
/*
*= require_self
*/
html, body {
background-color: #eee;
}
body {
padding-top: 40px; /* 40px to make the container go all the way to the bottom of the topbar */
}
@randito
randito / grid.js
Created October 10, 2011 16:20 — forked from webxl/grid.js
CSS prototyping bookmarklet
javascript:(function(){s1=document.createTextNode('body::before { content:""; position:fixed; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAACxEAAAsRAX9kX5EAAAAZdEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjVJivzgAAAAyUlEQVRoQ%2B2abQqAIBBEPW1X6CzdqTv1RUFIipi2o72gPyXV7uybKci5wDZM8xI6dz%2Buvs6pP2Dq81GI2qiiiJkiOzQ97EGHTXUF9XUwYsaI2o1LjyqjpaYwiqDI2YFs2HtI9Wjx2Z0R%2B1ADdmB%2FC7taB0uzCSNqCqOImSIkeyW7xLXMZvqjdzJcS01hFEGRSnbe3miR7JVGgWRXcxkUQRFgj%2F8Y8htGtkJHL%2FvGaGtKd6bU9Z4C%2FCiEZDeCPahIa%2FbbDSNX433mVkIrV5rTnhDyAAAAAElFTkSuQmCC) 50% 0; z-index:1; top:0; right:0; bottom:0; left:0; opacity:.3; pointer-events:none; } * { -webkit-user-modify: read-write; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; } a { -webkit-user-modify: initial; }');s2=document.createTextNode('#a1_z { background-color: #fff; float: left; position: absolute; z-index:2; padding: 3px; border: 1px solid; }');css=document.createE