Divide the length of the input string by 4, take the remainder. If it is 2, add two =
characters at the end. If it is 3, add one =
character at the end.
You now have Base64-URL with padding.
# 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 |
(function () { | |
WebSocket.prototype._send = WebSocket.prototype.send; | |
WebSocket.prototype.send = function (data) { | |
this._send(data); | |
this.addEventListener('message', function (msg) { | |
console.log('>> ' + msg.data); | |
}, false); | |
this.send = function (data) { | |
this._send(data); | |
console.log("<< " + data); |
#!/bin/bash | |
# Script intended to be executed from ncmpcpp (execute_on_song_change | |
# preference) running from urxvt to set album cover as background image | |
# Copyright (c) 2013 Vyacheslav Levit | |
# Licensed under The MIT License: http://opensource.org/licenses/MIT | |
MUSIC_DIR=$HOME/Music | |
DARKEN=50 # 0 - original image colors, 100 - absolutely black background |
Exporting: | |
mysqldump -u user -p database | gzip > database.sql.gz | |
Importing: | |
gunzip < database.sql.gz | mysql -u user -p database |
<?php | |
# http://jeffreysambells.com/2012/10/25/human-readable-filesize-php | |
function human_filesize($bytes, $decimals = 2) { | |
$size = array('B','kB','MB','GB','TB','PB','EB','ZB','YB'); | |
$factor = floor((strlen($bytes) - 1) / 3); | |
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$size[$factor]; | |
} | |
echo human_filesize(filesize('example.zip')); |
#!/bin/bash | |
# CHANGE THESE | |
auth_email="[email protected]" | |
auth_key="c2547eb745079dac9320b638f5e225cf483cc5cfdda41" # found in cloudflare account settings | |
zone_name="example.com" | |
record_name="www.example.com" | |
# MAYBE CHANGE THESE | |
ip=$(curl -s http://ipv4.icanhazip.com) |
{ "keys": ["ctrl+alt+p"], "command": "prompt_select_workspace" } |
// connect() is a function that injects Redux-related props into your component. | |
// You can inject data and callbacks that change that data by dispatching actions. | |
function connect(mapStateToProps, mapDispatchToProps) { | |
// It lets us inject component as the last step so people can use it as a decorator. | |
// Generally you don't need to worry about it. | |
return function (WrappedComponent) { | |
// It returns a component | |
return class extends React.Component { | |
render() { | |
return ( |