View base_62_converter.py
#!/usr/bin/env python | |
# | |
# Converts any integer into a base [BASE] number. I have chosen 62 | |
# as it is meant to represent the integers using all the alphanumeric | |
# characters, [no special characters] = {0..9}, {A..Z}, {a..z} | |
# | |
# I plan on using this to shorten the representation of possibly long ids, | |
# a la url shortenters | |
# |
View annotate.py
#!/usr/local/bin/python | |
# -*- coding: utf-8 -*- | |
# Refactoring the [neighborhood annotation script](https://github.com/codefornola/nola-neighborhood-annotation) to | |
# utilize [the nolabase](https://github.com/codefornola/nolabase/) instead of using all the data | |
# and doing the computation locally. | |
# This demonstrates using the nolabase as a dependency to a community run application or tool. | |
# Run it by passing a connection string and an input and output csv file: | |
# ``` | |
# # get 2021 calls for service data as a test |
View sql_canary.rb
class SqlCanary | |
def self.enable! | |
Thread.current[:sql_canary] = true | |
end | |
def self.disable! | |
Thread.current[:sql_canary] = false | |
end | |
def self.enabled? |
View recurly_bot.ex
defmodule RecurlyBot do | |
use Application | |
# See http://elixir-lang.org/docs/stable/elixir/Application.html | |
# for more information on OTP Applications | |
def start(_type, _args) do | |
import Supervisor.Spec, warn: false | |
# Define workers and child supervisors to be supervised | |
children = [ |
View test.php
<?php | |
// This example is for testing php with libcurl | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, "https://www.howsmyssl.com/a/check"); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
View urban_access_test.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View fetch.rb
REGION = 'neworleans' | |
BASE_URL = "https://#{REGION}.craigslist.org" | |
parse_listings = lambda do |url| | |
results = JSON.parse Net::HTTP.get(URI(url)) | |
results.first.each do |item| | |
if item.key? 'GeoCluster' | |
parse_listings.call("#{BASE_URL}#{item['url']}") |
View binary_sort.rb
class BinaryTree | |
attr_accessor :value, :left, :right | |
def insert(value) | |
if @value | |
if value < @value | |
@left ||= BinaryTree.new | |
@left.insert(value) | |
else |
View process.js
"use strict"; | |
let im = require('imagemagick'); | |
let async = require('async'); | |
let fs = require('fs'); | |
let request = require('request'); | |
let path = require('path'); | |
let os = require('os'); | |
let fetchAndProcess = (task, done) => { |
View face_extract.rb
require "opencv" | |
require "fileutils" | |
include OpenCV | |
detector = CvHaarClassifierCascade::load("./haarcascade_frontalface_alt.xml") | |
input_dir = ARGV[0] | |
output_dir = ARGV[1] || 'output' | |
FileUtils.mkdir_p(output_dir) |
NewerOlder