Skip to content

Instantly share code, notes, and snippets.

View davoclavo's full-sized avatar
🎯
Focusing

Davo davoclavo

🎯
Focusing
View GitHub Profile
@davoclavo
davoclavo / conn.ex
Last active June 16, 2016 07:10
Plug.Conn.to_uri
defmodule Plug.Conn do
def to_uri(conn) do
query = case conn.query_string do
"" -> nil
query -> query
end
%URI{
scheme: conn.scheme |> to_string,
host: conn.host,
port: conn.port,
@davoclavo
davoclavo / up-and-running-with-edeliver-on-do.md
Last active June 6, 2022 11:55 — forked from mattweldon/up-and-running-with-edeliver-on-do.md
Getting Elixir / Phoenix running on Digital Ocean with edeliver

Build Server

  • Go to Digital Ocean
  • Create new ubuntu droplet

Setup Server

@davoclavo
davoclavo / dokku_on_digital_ocean.md
Created March 20, 2016 23:04 — forked from henrik/dokku_on_digital_ocean.md
Notes from running Dokku on Digital Ocean.

My notes for Dokku on Digital Ocean.

Commands

Install dokku-cli (gem install dokku-cli) for a more Heroku-like CLI experience (dokku config:set FOO=bar).

# List/run commands when not on Dokku server (assuming a "henroku" ~/.ssh/config alias)
ssh henroku dokku
ssh henroku dokku config:get my-app

emacs --daemon to run in the background. emacsclient.emacs24 <filename/dirname> to open in terminal

NOTE: "M-m and SPC can be used interchangeably".

  • Undo - C-/
  • Redo - C-?
  • Change case: 1. Camel Case : M-c 2. Upper Case : M-u
  1. Lower Case : M-l
#! /bin/sh
# /etc/init.d/doorbot
### BEGIN INIT INFO
# Provides: doorbot
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Simple script to start doorbot
@davoclavo
davoclavo / core.clj
Last active September 3, 2019 20:51
courjera
(ns courjera.core
(:require [clj-http.client :as client]
[clojure.data.json :as json]
[clojure.string :as string]
[clj-time.core :as t]
[clj-time.format :as f]
[courjera.models :as m]
[clojure.java.io :as io]))
(System/setProperty "https.proxyHost" "localhost")
@davoclavo
davoclavo / ConfigurableFirmata.ino
Created September 15, 2014 19:46
adding DHT11Feature
/*
* Firmata is a generic protocol for communicating with microcontrollers
* from software on a host computer. It is intended to work with
* any host computer software package.
*
* To download a host software package, please click on the following link
* to open the download page in your default browser.
*
* http://firmata.org/wiki/Download
*/
https://docs.google.com/presentation/d/1Cxgs9sklnKU3KEBSVCLlDswFbYUjYYZciaMNF9ipVZU
@davoclavo
davoclavo / vine_hasher.rb
Last active October 15, 2016 20:56
tool to unhash/hash vine ids
module VineHasher
VINE_KEY = 'BuzaW7ZmKAqbhMOei5J1nvr6gXHwdpDjITtFUPxQ20E9VY3Ll'
VINE_KEY_SIZE = VINE_KEY.size
VINE_KEY_HASH = VINE_KEY.split('').each_with_index.inject({}) {|hash, (key, index)| hash[key] = index; hash }
def unhash_id(hashed_id)
hashed_id.reverse.split('').each_with_index.inject(0) { |total, (key, index)| total + VINE_KEY_HASH[key] * VINE_KEY_SIZE**index }
end
def hash_id(id)
@davoclavo
davoclavo / gist:6695306
Last active December 23, 2015 21:19
vine's /static/style.css fix
// Line 99
// From this
-moz-box-shadow:inset 0 1px 0 rgba(255,255,255);
// To this
-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,0.4);