Skip to content

Instantly share code, notes, and snippets.

View borisnadion's full-sized avatar

Boris Nadion borisnadion

View GitHub Profile
@borisnadion
borisnadion / serve_s3_images_from_own_domain.js
Created January 6, 2022 06:34 — forked from lfjeff/serve_s3_images_from_own_domain.js
Serve S3 images from your own domain using Cloudflare worker
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
/**
* When we receive a request, fetch it from our S3 bucket
*
* For example, a request for:
* https://mydomain.com/images/castle01.jpg
* will be fetched from:
@borisnadion
borisnadion / download-maniest.rb
Created January 3, 2022 16:17
Download manifest.json and all the files for further analyzing
require 'rubygems'
gem 'json'
require 'json'
require 'pathname'
require 'open-uri'
# changeme, must NOT have ending slash
URL = "https://www.example.com"
def save_file(url, path)
@borisnadion
borisnadion / Attention.py
Created May 23, 2017 21:05 — forked from luthfianto/Attention.py
Keras Layer that implements an Attention mechanism for temporal data. Supports Masking. Follows the work of Raffel et al. [https://arxiv.org/abs/1512.08756]
from keras.layers.core import Layer
from keras import initializers, regularizers, constraints
from keras import backend as K
class Attention(Layer):
def __init__(self,
kernel_regularizer=None, bias_regularizer=None,
kernel_constraint=None, bias_constraint=None,
use_bias=True, **kwargs):
"""
keep

Homebrew Formula patching old ImageMagick release 6.7.7-10

Install

$ brew install https://gist.github.com/borisnadion/29f835ef036b404ddaef/raw/2aacfe38abba9d38dc0fe8da03a7ebe73df1490a/imagemagick.rb

Tested

module ActiveRelationExtensions
def find_each_with_order(options = {})
find_in_batches_with_order(options) do |records|
records.each { |record| yield record }
end
end
# NOTE: any limit() on the query is overridden with the batch size
def find_in_batches_with_order(options = {})
@borisnadion
borisnadion / gist:5340768
Last active December 15, 2015 23:29 — forked from sowenjub/gist:1033876
capture and download the latest backup from heroku, load it locally, and open safari 8-[] ?
#!/bin/bash
# This script does the following:
# 1/ capture and download the latest backup
# 2/ load it to your local database
# 3/ run your app and open Safari
# Just replace any uppercase string with your own data
#