Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lyoshenka
lyoshenka / maintenance.html
Last active October 17, 2017 22:40 — forked from pitch-gist/gist:2999707
Simple Maintenance Page
<!doctype html>
<html><head>
<meta charset="utf-8" />
<title>Site Maintenance</title>
<style type="text/css">
body { padding: 50px 30px 30px; font: 20px Helvetica, sans-serif; color: #222; line-height: 1.4 }
h1 { font-size: 40px; }
article { text-align: left; max-width: 650px; margin: 0 auto; }
a { color: #dc8100; padding: 3px }
a:hover { color: #fff; background-color: #dc8100 }
@lyoshenka
lyoshenka / passwordgen.sh
Last active May 17, 2016 13:26 — forked from linuxboytoo/passwordgen.sh
Bash Random Password Generator
#!/bin/bash
head -n100 /dev/urandom | strings | egrep -o '([a-zA-Z0-9#%&^])' | awk '{ORS=""; print $1}' | head -c 35; echo
@lyoshenka
lyoshenka / latency.txt
Created February 17, 2016 17:38 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
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
@lyoshenka
lyoshenka / twerkify-bookmarklet.js
Last active October 22, 2015 19:14 — forked from jacopotarantino/twerkify.js
Twerkify - Make your website twerk.
javascript:!function(){"use strict";function e(){var e,t,a;e=JSON.parse(this.responseText),t=document.querySelectorAll("img"),a=Array.prototype.slice.call(t),a.forEach(function(t){var a=e.data[Math.floor(Math.random()*e.data.length)];t.src=a.images.fixed_height.url})}console.log("Thank you for twerking");var t;t=new window.XMLHttpRequest,t.addEventListener("load",e),t.open("GET","https://api.giphy.com/v1/gifs/search?q=twerking&api_key=dc6zaTOxFJmzC"),t.send()}();
@lyoshenka
lyoshenka / unserialize.js
Last active December 21, 2018 09:39 — forked from brucekirkpatrick/jquery.unserialize.js
Takes a string in format "param1=value1&param2=value2" and returns an javascript object. The opposite of https://api.jquery.com/serialize
/**
* $.unserialize
*
* Takes a string in format "param1=value1&param2=value2" and returns an object { param1: 'value1', param2: 'value2' }. If the "param1" ends with "[]" the param is treated as an array.
*
* Example:
*
* Input: param1=value1&param2=value2
* Return: { param1 : value1, param2: value2 }
*
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

#!/bin/bash
## Copyright (C) 2009 Przemyslaw Pawelczyk <przemoc@gmail.com>
## License: GNU General Public License v2, v3
#
# Lockable script boilerplate
### HEADER ###
LOCKFILE="/var/lock/`basename $0`"
@lyoshenka
lyoshenka / pre-commit
Last active August 29, 2015 14:06 — forked from Simbul/pre-commit
#!/usr/bin/env ruby
# This pre-commit hook will prevent any commit to forbidden branches
# (by default, "staging" and "production").
# Put this file in your local repo, in the .git/hooks folder
# and make sure it is executable.
# The name of the file *must* be "pre-commit" for Git to pick it up.
FORBIDDEN_BRANCHES = ["staging", "production"]
@lyoshenka
lyoshenka / pre-push.sh
Last active June 14, 2023 06:55 — forked from greglboxer/pre-push.sh
Git pre-push hook to prevent force-pushing or deleting a special branch (e.g. master)
#!/bin/bash
# Requires git 1.8.2 or newer
# Prevents force-pushing or deleting a special branch (e.g. master).
# Based on: https://gist.github.com/pixelhandler/5718585 and https://gist.github.com/stefansundin/d465f1e331fc5c632088
# Install:
# cd path/to/git/repo
# curl -fL -o .git/hooks/pre-push https://gist.githubusercontent.com/lyoshenka/158cfff41d09e1dcf029/raw/pre-push.sh
# chmod +x .git/hooks/pre-push