This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Spotify's desktop UI no longer allows you to copy to clipboard all track URIs for a playlist | |
# Script taken from https://github.com/hbashton/spotify-ripper/issues/61 | |
# Requirements: python v2, spotipy (can be install from pip) | |
# Usage: First go to Spotify developer page and create a new app for client_id and client_secret | |
# export SPOTIPY_CLIENT_ID=<your_client_id> | |
# export SPOTIPY_CLIENT_SECRET=<your_client_secret> | |
# python spotify_get_playlist_track_uris.py <playlist-uri> | |
from spotipy.oauth2 import SpotifyClientCredentials |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[client] | |
port = 3306 | |
socket = /var/run/mysqld/mysqld.sock | |
[mysqld_safe] | |
pid-file = /var/run/mysqld/mysqld.pid | |
socket = /var/run/mysqld/mysqld.sock | |
nice = 0 | |
[mysqld] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Taken largely from https://gist.github.com/tsuna/2245176 | |
import java.sql._ | |
import java.util.concurrent.ArrayBlockingQueue | |
import java.util.concurrent.Executors | |
import java.util.concurrent.ThreadFactory | |
import java.util.concurrent.atomic.{AtomicLong, AtomicInteger} | |
import java.util.concurrent.TimeUnit.MILLISECONDS | |
import scala.collection.mutable.ArrayBuffer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <LiquidCrystal.h> | |
#include "DHT.h" | |
#define DHTTYPE DHT11 | |
template<class T> inline Print &operator <<(Print &obj, T arg) { obj.print(arg); return obj; } | |
/* Enable/Disable Features */ | |
bool enableDhtSensor0 = true; | |
bool enableDhtSensor1 = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Imports & Definitions */ | |
#include <LiquidCrystal.h> | |
#include "DHT.h" | |
#include <MemoryFree.h> | |
#include <SerialReceiver.h> | |
#define DHTTYPE DHT11 | |
template<class T> inline Print &operator <<(Print &obj, T arg) { obj.print(arg); return obj; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- @desc: Return the sum of all scores in a sorted set | |
-- @usage: redis-cli eval "$(cat ZSUM.lua)" N <zset1> <zset2> ... <zsetN> | |
-- @return: integer sum | |
local function ZSUM(keys) | |
local sum = 0 | |
local function sumKeyScores(key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- @desc Returns the std deviation of a ZSET key | |
-- @usage redis-cli EVAL "$(cat ZSTDDEV.lua)" 1 <zsetKey> | |
-- @return string representation of float value | |
local function ZSTDDEV(key) | |
local mean, sum, size, sumsqrs = 0, 0, 0, 0 | |
local memberScores = redis.call("ZRANGE", key, 0, -1, "WITHSCORES") | |
local scores = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- @desc: Spread members between two ZSETs so they are even size | |
-- @usage: redis-cli eval "$(cat ZSPREAD.lua)" 2 <zset1> <zset2> | |
-- @return: list of spread members | |
local function round(num) | |
if num >= 0 then return math.floor(num+.5) | |
else return math.ceil(num-.5) end | |
end | |
local function randomFromTo(from, to) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- @desc: Split a ZSET in two via round-robin | |
-- @usage: redis-cli eval "$(cat ZSPLIT)" 2 <originalZset> <newZset> | |
-- @return: list of moved members | |
local function ZSPLIT(zset1, zset2) | |
local zset1size = redis.call("ZCARD", zset1) | |
if zset1size == 0 then return {} end | |
local members = redis.call("ZREVRANGEBYSCORE", zset1, "+INF", "-INF", "WITHSCORES") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- @desc: Return the mean of a ZSET | |
-- @usage: redis-cli eval "$(cat ZMEAN.lua)" 1 <zsetKey> | |
-- @return: string representation of float | |
local function ZMEAN(key) | |
local keySum = 0 | |
local membersWithScores = redis.call("ZREVRANGE", key, 0, -1, "WITHSCORES") |
NewerOlder