Skip to content

Instantly share code, notes, and snippets.

@andreaskoepf
andreaskoepf / 2d_conv_test.lua
Last active December 24, 2015 20:38
Shows that forwad and backward operations of SpatialConvolution and SpatialFullConvolution are swapped...
require 'nn'
x = torch.rand(1,5,5)
a = nn.SpatialConvolution(1,1,3,3)
a.bias:zero()
ay1 =torch.xcorr2(x,a.weight,'V')
ay2 = a:forward(x)
b = nn.SpatialFullConvolution(1,1,3,3)
b.bias:zero()
@itamarhaber
itamarhaber / 10-redis-commandments.md
Last active September 25, 2015 08:49
Ten Redis Commandments

creative

"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

Ten Redis Commandments

I. I am thy open source, BSD licensed, data structure store

II. Thou shalt have no other data but that which fits in RAM

@jareware
jareware / s3-curl-backups.md
Last active August 29, 2021 00:56
Simple, semi-anonymous backups with S3 and curl

⇐ back to the gist-blog at jrw.fi

Simple, semi-anonymous backups with S3 and curl

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.

Bucket setup

@mks-m
mks-m / tiny_redis.rb
Last active April 7, 2021 16:47
tiny_redis_client.rb
# 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"
@losinggeneration
losinggeneration / gist:8382292
Created January 12, 2014 08:32
Lua markdown
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))
@catwell
catwell / active.md
Last active December 21, 2023 09:47
Speakerdecks
@catwell
catwell / b64url-np.md
Last active November 27, 2022 21:18
Decoding Base64-URL without padding

Decoding Base64-URL without padding

1) Add padding

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.

2) Translate to Base64

@catwell
catwell / gist:3033209
Created July 2, 2012 13:16
Richard Cook (on resilience of complex systems)
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
@Jaybles
Jaybles / UIDeviceHardware.h
Created October 28, 2011 19:33
UIDeviceHardware - Determine iOS device being used
//
// UIDeviceHardware.h
//
// Used to determine EXACT version of device software is running on.
#import <Foundation/Foundation.h>
@interface UIDeviceHardware : NSObject
- (NSString *) platform;
@ghoseb
ghoseb / factorial.py
Created November 14, 2008 18:58
The evolution of a Python Programmer
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal