Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View vgan's full-sized avatar

Steve vgan

View GitHub Profile
@vgan
vgan / drums_9-5-20.rb
Last active September 5, 2020 23:01
Sonic Pi Drum loop
sample :drum_splash_soft
define :paradiddle_quarters do
sample :drum_snare_soft,amp: choose([1,0.8,0.8,0.6,0.5]), decay: 3
sleep 0.25
sample :drum_snare_hard,amp: choose([0.8,0.8,0.6,0.5]), decay: 3
sleep 0.25
sample :drum_snare_soft,amp: choose([0.8,0.8,0.6,0.5]), decay: 3
sleep 0.25
sample :drum_snare_soft,amp: choose([0.8,0.8,0.6,0.5]), decay: 3
@vgan
vgan / sqlite_db_bot_example.md
Last active August 31, 2018 10:44
This is an example of a Python based Mastodon bot which reads and writes to an SQLite DB
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf8')
from mastodon import Mastodon,StreamListener
import sqlite3 as lite
from bs4 import BeautifulSoup
@vgan
vgan / beautiful_soup_i_tags.md
Last active November 29, 2017 20:19
Using Beautiful Soup to extract text from the Italic Tags in an OCR'd book

Using Beautiful Soup to extract text from the Italic Tags in an OCR'd book (ugly ms word html)

Requires Beautiful Soup if you don't already have it:

pip install bs4

##!/usr/bin/env python
@vgan
vgan / QuickType_and_Speak.scpt
Created February 4, 2017 16:20
Generates a sentence using MacOS QuickType and speaks it with Daniel.
tell application "TextEdit"
activate
make new document at the front
end tell
tell application "System Events"
repeat 10 times
key code 53 using {option down}
key code 49
end repeat
key code 53 using {option down}

Keybase proof

I hereby claim:

  • I am vgan on github.
  • I am vgan (https://keybase.io/vgan) on keybase.
  • I have a public key whose fingerprint is D821 D6D1 AFB2 EAB9 1EBD EA9E 4BF2 A256 0E7D 8C35

To claim this, I am signing this object:

@vgan
vgan / arniecommentary.md
Last active January 16, 2017 12:14
Image captioning bot in the style of an Arnold Schwarzenegger DVD Commentary

Arnie Commentary is a Python based bot which procedurally finds and captions images in the style of an Arnold Schwarzenegger DVD commentary.

The bot first selects a random Arnold Scwarzenegger movie from a list of all his movies and uses Movie_Title + " Arnold Schwarzenegger Sceencap" as a Bing image API query.

Next, it runs OCR locally using Tesseract - if more than a couple of words are detected the image is deleted and it starts over.

The image is then posted to Microsoft Project Oxford Describe Endpoint and a basic description is returned (usually).

Next it uses ImageMagick to check the orientation. If its not landscape, again it's deleted and starts over.

@vgan
vgan / lunch_oracle.md
Last active April 20, 2016 19:46
Instructions for Lunch Oracle

The Lunch Oracle

The Lunch Oracle is a Bot to tell you where to eat lunch when you can't decide.

Usage:

  • Tweet or DM your location info and receive a recommendation back. Results are limited to a citywide area (800 Meters/ 1/2 Mile Radius)
  • Tweet location can be in the following formats:
    • zip / postal code ex: 90027
    • Neighborhood Name, State/ Province
    • It may work in its own: Los Feliz
    • It can help to add State/ Province: Los Feliz, CA
  • ...and Country to be even more specific: Los Feliz, CA USA