Skip to content

Instantly share code, notes, and snippets.

@duzun
duzun / backup.sh
Last active August 29, 2015 14:11
MySQL auto-backup script
#! /bin/sh
#
# Author: Dumitru Uzun (DUzun)
#
# Ussage:
# backup [-k <days>] [-s <subdir>] [-d <database>] [-e <exclude_tables_list>]
#
pass='<best-password-ever>'
user=backup
/**
* A script for transitioning to HTTPS for clients that support it.
*
* This script will make a request to https:yourdomain.com/ping?_clb_=?
* from the loaded http: document.
* If the request is successful, it will convert all the internal links
* to https:
*/
jQuery(function ($) {
if(location.protocol === 'http:') {

The 10 Commandments of Modern Web Application

1. Instant Access

  • No Flash, Java or other plugins

2. Responsive Design

  • Responsive Layout
  • Mobile First
@duzun
duzun / install-addon
Last active August 29, 2015 14:20 — forked from jeffgca/install-addon
A node script that abuses child_process to run cfx and post the resulting xpi to Firefox.
#!/usr/bin/env node
/**
* A node script that abuses child_process to run cfx and post the resulting xpi to Firefox.
* Requires: a working installation of the Add-on SDK (with cfx on your PATH)
* and a recent version of Firefox with the 'Extension Auto-installer' extension installed.
*
* Original gist https://gist.github.com/canuckistani/9301061
*
* Improved by Dumitru Uzun (DUzun.Me)
@duzun
duzun / HTTPAuthLogout.js
Last active August 29, 2015 14:24
Logout from a website using HTTP Authorization - Bookmarklet
/**
* Logout from a website using HTTP Authorization.
*
* Inspired by http://stackoverflow.com/a/14329930/1242333
*
*/
(function(window,location,command,outcome,undefined){
function done(e) {
if ( !e || this.readyState == 4 ) {
outcome && location.reload();
@duzun
duzun / gotoGithubIO-bookmarklet.html
Last active October 22, 2015 20:32
Go to github.io of a github repo which has gh-pages branch.
<a class="btn btn-default btn-info bookmarklet" href="javascript:(function(d,b,c,a){b=d.location;a=b.pathname.split('/');c=b.hostname;return'github.com'==c&&2<a.length?(a=b.protocol+'//'+a[1]+'.'+c.replace(/\.com$/,'.io')+'/'+a[2],void d.open(a,'_blank')):alert('Go to a github repo and try again!'),!1})(this);">
Go to Github.IO
</a>
@duzun
duzun / latency.markdown
Created May 7, 2016 14:51 — 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