Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* @uri /lyrics/:artist/:title
*/
class Lyrics extends Tonic\Resource {
/**
* @method GET
* @provides application/json
File.open('foo_sorted_reduced.tab', 'w:UTF-8') { |f|
File.open('foo_sorted.tab', 'r:UTF-8').each_line do |line|
parts = line.strip.split("\t")
song_id = parts[0]
artist = parts[1]
title = parts[2]
date = parts[3]
country = parts[4]
if last_song_id == -1
last_song_id = song_id
@chadkouse
chadkouse / elasticsearch parent child
Created June 5, 2013 15:41
Requests to elasticsearch to index a share + comments
PUT to http://host:9200/shares/share/1370441011073780507
content:
{
"artist": "Black Sabbath",
"id": "1370441011073780507",
"lyrics": "",
"song_title": "Am I Going Insane",
"media_url": "http://s3.amazonaws.com/images.tunewiki.com/shares/mobile/large/75475a5f15a0d9be76bf6822139119c0.jpg",
"has_lyric_art": true,
"has_comment": true,
@chadkouse
chadkouse / dal.js
Created October 22, 2013 21:53
node.js dynamodb scan
doScan: function (tableName, limit, startKey, callback) {
limit = typeof limit !== 'undefined' ? limit : null;
startKey = typeof startKey !== 'undefined' ? startKey : null;
var self = this;
var params = {TableName: tableName};
if (limit != null)
params.Limit = limit;
if (startKey != null)
params.ExclusiveStartKey = startKey;
var items = [];
loadObjectsFromArray: function (arr, finalCallback) {
var callbackCount = 0;
var embed = [];
var finishCallback = function () {
callbackCount++;
if (callbackCount >= arr.length) {
finalCallback(embed);
}
};
var cardNumber = ""
var cvv = ""
var expirationMonth = 0
var expirationYear = 0
var showError:(String)->Void = { errorMsg in
let alert = UIAlertView(title: "Missing Information", message: "Please ensure your \(errorMsg) is correct", delegate: nil, cancelButtonTitle: "OK")
alert.show()
}
{
init: function (elevators, floors) {
function findLeastBusyElevator() {
var e = elevators[0];
elevators.forEach(function (el) {
if (el.destinationQueue.length < e.destinationQueue.length)
e = el;
});
return e;
}

Keybase proof

I hereby claim:

  • I am chadkouse on github.
  • I am adko (https://keybase.io/adko) on keybase.
  • I have a public key whose fingerprint is 287E 9B4E 48F3 9C77 DA09 080F 69FE 0A32 03C4 6E49

To claim this, I am signing this object:

@chadkouse
chadkouse / README.md
Last active November 6, 2023 22:24
Automatically upload screenshots and screen recordings to s3, like jumpshare for linux

Make sure you have a working and configured s3cmd and you have notify-send installed

Update upload_screenshot to point to your s3 bucket and path

you may need to update DISPLAY and DBUS_SESSION_BUS_ADDRESS (from a working terminal in your X session you can find these by doing echo $DISPLAY && echo $DBUS_SESSION_BUS_ADDRESS )

make sure upload_screenshot is in your (and probably root's) PATH (I put mine in /usr/local/bin) -- also make sure it's executable chmod a+x upload_screenshot

Set up the directory to watch in your incrontab (in my example /home/chadkouse/screenshots ) Any file you put into this directory will get uploaded to s3 and it's url copied to the clipboard.

@chadkouse
chadkouse / ascii_qr.md
Last active December 16, 2019 19:53
ascii qr code

█▀▀▀▀▀█  ▀▀█▄▄█ ▄ █▀▀▀▀▀█
█ ███ █ ▄▀██▄▄▀ ▄ █ ███ █
█ ▀▀▀ █ ▀▄█ ▀▀▄ ▀ █ ▀▀▀ █
▀▀▀▀▀▀▀ ▀▄▀ ▀ █▄█ ▀▀▀▀▀▀▀
██▄ ▄█▀█▄▀█▄ █▄▄▄  ▄██▄▄
▀▄▀▀ █▀▄ ▀▄▄▄▀█▀▄▄▄▄ █ ▀█
███▄▄▀▀▄ ▀██▄▄▄▄█ ▀▄   ▄▀
█  ▀▄▄▀ ▀ ▄▄▀  █▄▀ █▀█▄▀█
▀ ▀ ▀▀█▀▄█▀▀▄██▀▀▀█ ▀