Skip to content

Instantly share code, notes, and snippets.

@dvdbng
dvdbng / vim-heroku.sh
Last active October 16, 2024 17:15
Run vim in heroku updated 2017
mkdir ~/vim
cd ~/vim
# Staically linked vim version compiled from https://github.com/ericpruitt/static-vim
# Compiled on Jul 20 2017
curl 'https://s3.amazonaws.com/bengoa/vim-static.tar.gz' | tar -xz
export VIMRUNTIME="$HOME/vim/runtime"
export PATH="$HOME/vim:$PATH"
cd -
@kellyrmilligan
kellyrmilligan / s3Sync.sh
Created June 8, 2017 13:38
Sync files to s3 and set cache control headers
#!/bin/bash
if [[ "$1" != "" ]]; then
S3BUCKETNAME="$1"
else
echo ERROR: Failed to supply S3 bucket name
exit 1
fi
aws s3 sync build s3://$S3BUCKETNAME --delete --cache-control max-age=31536000,public
@learner-long-life
learner-long-life / Rinkeby.md
Last active August 30, 2022 22:32
How to get on Rinkeby Testnet in less than 10 minutes

How to get on Rinkeby Testnet in less than 10 minutes

Following instructions from the excellent https://www.rinkeby.io/

Synchronizing a Full Node

A full node lets you access all state. There is a light node (state-on-demand) and wallet-only (no state) instructions as well,

@peterdalle
peterdalle / robots.txt
Created December 3, 2016 15:18
Robots.txt that makes sure Facebook and Twitter can crawl images on your site.
# Disallow everything.
User-agent: *
Disallow: /
# Certain social media sites are whitelisted to allow crawlers to access page markup when links to /images are shared.
User-agent: Twitterbot
Allow: /images
User-agent: facebookexternalhit
Allow: /images
@mhluska
mhluska / match_images.py
Created October 9, 2016 04:55
Quick and dirty script to match similar images using image_match
from image_match.goldberg import ImageSignature
import glob
BASE_DIR='/Users/maros.hluska/Dropbox'
BASE_IMAGE='./crop.png'
gis = ImageSignature()
def filenames(extension):
return glob.iglob(BASE_DIR + '/**/*.' + extension, recursive=True)
#!/bin/sh
# See https://github.com/xiaohan2012/twitter-sent-dnn
if [ "${#}" -eq 0 ]; then
echo "Usage: ${0} message"
exit 1
fi
html=$(curl 'https://twitter-sentiment-cnn.herokuapp.com/' \
@mhluska
mhluska / bot.rb
Last active September 1, 2016 11:28
Basic Tinder bot with sentiment analysis
require 'dotenv'
require 'tinderbot'
require 'sentimental'
Dotenv.load!
class Bot
MAX_DAYS_SINCE_REPLY = 5
MAX_DAYS_SINCE_MESSAGE = 2
MAX_DISTANCE_MI = 100
@Skorch
Skorch / s3-upload-processor.js
Last active January 18, 2021 09:13
AWS Lambda function which receives an S3 upload event, fetches the custom headers, parses the encoded payload, and handles the API call
var async = require('async');
var AWS = require('aws-sdk');
AWS.config.update({region:'us-east-1'});
var request = require('request');
var s3 = new AWS.S3({ apiVersion: '2006-03-01' });
var sns = new AWS.SNS();
var new_upload_arn = "arn:aws:sns:us-east-1:346805855669:vuedating_new_presenece";
//Lambda entry point
# O(n), n = total number of bits
def count_bits1(num):
count = 0
while num > 0:
if num % 2 == 1:
count += 1
num //= 2
return count
@janko
janko / 01-safe-download.rb
Last active February 18, 2025 08:40
A safe way in Ruby to download a file to disk using open-uri (with/without comments)
require "open-uri"
require "net/http"
Error = Class.new(StandardError)
DOWNLOAD_ERRORS = [
SocketError,
OpenURI::HTTPError,
RuntimeError,
URI::InvalidURIError,