Skip to content

Instantly share code, notes, and snippets.

View DavidWittman's full-sized avatar

David Wittman DavidWittman

View GitHub Profile
@lorin
lorin / preseed-fragment.seed
Last active November 30, 2022 04:04
Automated partitioning with Ubuntu preseed
# Use LVM for partitioning
d-i partman-auto/method string lvm
# If one of the disks that are going to be automatically partitioned
# contains an old LVM configuration, the user will normally receive a
# warning. Preseed this away
d-i partman-lvm/device_remove_lvm boolean true
# And the same goes for the confirmation to write the lvm partitions.
d-i partman-lvm/confirm boolean true
@nijikokun
nijikokun / example-user.js
Created May 3, 2012 20:46
Beautiful Validation... Why have I never thought of this before?!
var user = {
validateCredentials: function (username, password) {
return (
(!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' }
: (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' }
: (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' }
: (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' }
: (!/^([a-z0-9_-]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' }
: false
);
@uvsmtid
uvsmtid / salt_pillars_vs_grains.md
Last active March 5, 2024 20:45
Salt Grains vs Pillars

Salt Grains vs Pillars

Both grains and Pillars define input data to parameterize [Salt][1] states.

Depending on the purpose of data, one should make a choice to put it in one place or another.

NOTE:

  • This doc focuses on practical differences between Grains and Pillars for [default use case][2] only.
  • It is not about everything what is possible.
@obstschale
obstschale / octave.md
Last active March 29, 2024 22:51
An Octave introduction cheat sheet.
@spicycode
spicycode / tmux.conf
Created September 20, 2011 16:43
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active April 30, 2024 04:42
A badass list of frontend development resources I collected over time.
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 1, 2024 13:31
Useful PostgreSQL Queries and Commands
-- 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%'
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
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