Skip to content

Instantly share code, notes, and snippets.

{
"status": 200,
"likelihood": 0.88,
"requestId": "6b54dea7-0d45-4a2c-ab5d-3f749e90e2ae",
"photos": [
{
"url": "https://d2ojpxxtu63wzl.cloudfront.net/static/b19643dab35a1ac80271a6e80b960be4_0276f6bcee191441f6cc640002bede2e9f28a87191bffb5477096758bf746d1e",
"type": "facebook",
@sloria
sloria / recorder.py
Last active April 12, 2024 11:43
WAV recording functionality using pyaudio
# -*- coding: utf-8 -*-
'''recorder.py
Provides WAV recording functionality via two approaches:
Blocking mode (record for a set duration):
>>> rec = Recorder(channels=2)
>>> with rec.open('blocking.wav', 'wb') as recfile:
... recfile.record(duration=5.0)
Non-blocking mode (start and stop recording):
<?php
class ServiceHelper {
// @text is the full tweet text
// @shortCode is the code part of the shortlink, like nXXX0
public function shortenForTwitter($text, $shortCode=FALSE, $shortDomain=FALSE) {
$placeholders = array();
$rawTweet = $text;