Skip to content

Instantly share code, notes, and snippets.

0471dffb1cf706c44b6bfcb85b14e7e7b6f0a0b2c934a690ffd5c5da25d3127b8ad8bc0ab44444bd6f0ede37c600e3de0fec63fff5878774c17f1b835b8f17aadc;halkuon
@8bithero
8bithero / mailgun.ex
Created March 22, 2017 16:39 — forked from kf0jvt/mailgun.ex
Example of using Elixir and HTTPotion to send mail to Mailgun using the api.
defmodule Mailgun do
@doc """
Sends a basic message to an address. Expects a mailgun domain environment
variable (MAILGUN_DOMIAN) and a mailgun api key environment variable
(MAILGUN_API_KEY).
"""
@spec mail(String.t) :: String.t
def mail(toAddress) do
url = "https://api.mailgun.net/v3/#{System.get_env("MAILGUN_DOMAIN")}/messages"
headers = ["User-Agent": "Elixir",
@8bithero
8bithero / API.md
Last active August 29, 2015 14:16 — forked from iros/API.md

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

app.directive('scrollSpy', function ($window) {
return {
restrict: 'A',
controller: function ($scope) {
$scope.spies = [];
this.addSpy = function (spyObj) {
$scope.spies.push(spyObj);
};
},
link: function (scope, elem, attrs) {
@8bithero
8bithero / 0_reuse_code.js
Created October 4, 2013 07:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#!/usr/bin/env ruby
#
# Proof-of-Concept exploit for Rails Remote Code Execution (CVE-2013-0156)
#
# ## Advisory
#
# https://groups.google.com/forum/#!topic/rubyonrails-security/61bkgvnSGTQ/discussion
#
# ## Caveats
#
@8bithero
8bithero / foobar
Created December 27, 2012 14:06
foo foo foobar
#BundleBackend REST API v1.0
## Categories
> **GET** danezo.com/categories
**Required parameters:**
**Optional parameters:**
@8bithero
8bithero / API.md
Created November 29, 2012 14:58 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@8bithero
8bithero / google_speech_recognition.rb
Created June 13, 2012 12:21 — forked from pachacamac/google_speech_recognition.rb
google speech recognition with ruby
require 'rest_client'
require 'json'
a = `sox -d --norm -t .flac - silence -l 1 0 1% 1 6.0 1% rate 16k`
#a = `arecord -q -d 3 -c 1 -f S16_LE -r 22050 -t wav | flac - -f --totally-silent -o-`
r = RestClient.post 'https://www.google.com/speech-api/v1/recognize?lang=en-US', a,
:content_type => 'audio/x-flac; rate=16000'
if j = JSON.parse(r)
(p j; `espeak 'you said: #{j['hypotheses'].first['utterance']}'`)
end