Skip to content

Instantly share code, notes, and snippets.

View guanix's full-sized avatar

Guan Yang guanix

  • 44FE 23DB 362F 611C 0CC3 116B D49B 113D 48DC 370E
  • New York
View GitHub Profile
#!/bin/sh
# FACTCHECK: Double-check you got your stuff right.
# This is the filename of the new hotlist for users you need to re-download.
# Run it in the script directory, it'll go down and smash the furniture properly.
echo "" > missing-hotlist.txt
cd videos
for each in *
--- ../yahoo/youtube-dl 2011-02-10 22:10:41.000000000 +0000
+++ youtube-dl 2011-02-21 01:51:54.000000000 +0000
@@ -535,7 +535,7 @@
template_dict = dict(info_dict)
template_dict['epoch'] = unicode(long(time.time()))
template_dict['autonumber'] = unicode('%05d' % self._num_downloads)
- filename = self.params['outtmpl'] % template_dict
+ filename = (self.params['outtmpl'] % template_dict).replace("/", "_")
return filename
except (ValueError, KeyError), err:
--- ../yahoo/youtube-dl 2011-02-10 22:10:41.000000000 +0000
+++ youtube-dl 2011-02-21 01:43:43.000000000 +0000
@@ -1714,13 +1714,11 @@
'url': video_url.decode('utf-8'),
'uploader': video_uploader.decode('utf-8'),
'upload_date': u'NA',
- 'title': video_title.decode('utf-8'),
- 'stitle': simple_title.decode('utf-8'),
+ 'title': video_title,
+ 'stitle': simple_title,
#!/opt/python2.7/bin/python
# -*- coding: utf-8 -*-
# Author: Ricardo Garcia Gonzalez
# Author: Danny Colligan
# Author: Benjamin Johnson
# Author: Vasyl' Vavrychuk
# Author: Witold Baryluk
# Author: Paweł Paprota
# License: Public domain code
import cookielib

Read Ken Rockwell on Modern Exposure.

The steps for taking a good photograph with a digital camera are:

  1. Take a photo.
  2. Look at the screen.
  3. Change settings.
  4. Go to back step 1.

The settings you'll want to change on an S90 are:

Watch my video explanation!

in_reply_to_id

in_reply_to_id is a piece of information that may be associated with a tweet. It is a reference to the tweet that is being replied to. On twitter.com, you can tell that in_reply_to_id is set because the “in reply to” link is visible. In other Twitter clients, there may be a similar link or an icon to show a discussion thread.

If in_reply_to_id is not set, then it can be difficult or impossible to tell which tweet is being replied to, and it can be difficult to reconstruct discussion threads.

Reply visibility

var continuables = require('continuables'), sys = require('sys');
function delay(timeout, fail) {
var continuable = continuables.create();
setTimeout(function () {
if (fail)
continuable.fulfill(new Error('fail'));
else
continuable.fulfill(true);
}, timeout);
require.paths.unshift('/Users/guan/code/node-promise');
var promise = require('node-promise'),
sys = require('sys');
process.mixin(GLOBAL, require('promise'));
// A promise version of setTimeout
var delay = function (timeout) {
var deferred = new process.Promise();
setTimeout(function () {
deferred.resolve();
open("path.tmp")
.then(function (stream) {
return stream.write("some text");
}).then(function (stream) {
return stream.close();
}).then(function () {
return rename("path.tmp", "path");
}, function (e) {
// one error handler for an error at any point in the chain
});
// fileIO style continuables example
// Note: All the three examples here are done based on the *same* API,
// namely the fileIO continuables API
// "Promise lite" style with either:
readFile("11.txt")(either(
function (e) {
// handle an error
},
function (obj) {