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.
#Newbie programmer | |
def factorial(x): | |
if x == 0: | |
return 1 | |
else: | |
return x * factorial(x - 1) | |
print factorial(6) | |
#First year programmer, studied Pascal |
// | |
// UIDeviceHardware.h | |
// | |
// Used to determine EXACT version of device software is running on. | |
#import <Foundation/Foundation.h> | |
@interface UIDeviceHardware : NSObject | |
- (NSString *) platform; |
# 1/ Read EXIF orientation flag | |
identify -format "%[EXIF:orientation]" myimage.jpg | |
# NOTE: jhead can be used too | |
# see http://www.sentex.net/~mwandel/jhead/ | |
jhead -exifmap myimage.jpg | grep Ori | |
# 2/ Remove EXIF orientation | |
# i.e. rotate the image accordingly and reset the orientation | |
# flag to 1 (default, i.e. origin = TopLeft) |
I think you have to open the objects and open your methods. I think that | |
this idea of hiding in layers of abstraction everything about the | |
details has, in fact, pretty much run its course now. I think the idea | |
that we can make these sorts of black box devices that we only know | |
about the shell of and have no knowledge of the internal workings of is | |
in fact a deep mistake. Because it turns out that in order to be able to | |
reason about how the system is actually working, we have to have | |
knowledge about what is inside the black box. | |
http://www.youtube.com/watch?v=2S0k12uZR14 |
Confirming the theory that at some point most speakers drop out of the circuit and become less visible :)
function markdown() | |
{ | |
lua5.1 <(echo "$(cat << EOLUA | |
discount=require("discount") | |
if #arg > 0 then | |
for _,v in ipairs(arg) do | |
local lines = "" | |
local f = io.open(v, "r") | |
if not f then | |
io.output(io.stderr):write(string.format([[%s: No such file or directory\n]], v)) |
# Copyright 2017 Maksym Melnychok | |
# MIT License - https://opensource.org/licenses/MIT | |
# | |
# inspired by https://github.com/ptrofimov/tinyredisclient | |
require 'socket' | |
class TinyRedis | |
RN = "\r\n" |
⇐ back to the gist-blog at jrw.fi
Backing stuff up is a bit of a hassle, to set up and to maintain. While full-blown backup suites such as duplicity or CrashPlan will do all kinds of clever things for you (and I'd recommend either for more complex setups), sometimes you just want to put that daily database dump somewhere off-site and be done with it. This is what I've done, with an Amazon S3 bucket and curl
. Hold onto your hats, there's some Bucket Policy acrobatics ahead.
There's also a tl;dr at the very end if you just want the delicious copy-pasta.
"Went up the mountain, spent some time there, a bush or something was burning and I must have inhaled the smoke because I came back down carrying these two slabs of stone...", HippieLogLog
I. I am thy open source, BSD licensed, data structure store
II. Thou shalt have no other data but that which fits in RAM