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
"""Provides a `DateTimeRange` class, which is used for managing ranges of datetimes.""" | |
import datetime | |
class DateTimeRange(object): | |
"""Represents a range of datetimes, with a start and (optionally) an end. | |
Basically implements most of the methods on a standard sequence data type to provide | |
some lovely syntactic sugar. Specifically, you can iterate on this, index it, slice it, | |
use the in operator, reverse it, and use it in a boolean context to see if there is any | |
time in between the start and end.""" |
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
/* | |
* Example of a singleton design pattern. | |
* Copyright (C) 2011 Radek Pazdera | |
* This program is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, either version 3 of the License, or | |
* (at your option) any later version. | |
* This program is distributed in the hope that it will be useful, |
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
on adding folder items to thisFolder after receiving added_items | |
mount volume "afp://user@host/share" | |
delay 1 | |
repeat with addedFile in added_items | |
tell application "Finder" | |
if (the name of the addedFile ends with "torrent" or "nzb") then | |
display notification "Queueing " & (name of addedFile) & "." | |
try | |
tell application "Finder" | |
move addedFile to "spool" with replacing |
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
public class ComboNumericHeaderCell : DataGridViewColumnHeaderCell | |
{ | |
public readonly ComboBox _comboBox; | |
public readonly NumericUpDown _numericUpDown; | |
public ComboNumericHeaderCell() | |
{ | |
_comboBox = new ComboBox(); | |
_numericUpDown = new NumericUpDown(); | |
_comboBox.Font = Control.DefaultFont; |
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
import matplotlib.pyplot as plt | |
def zoom_factory(ax,base_scale = 2.): | |
def zoom_fun(event): | |
# get the current x and y limits | |
cur_xlim = ax.get_xlim() | |
cur_ylim = ax.get_ylim() | |
# set the range | |
cur_xrange = (cur_xlim[1] - cur_xlim[0])*.5 |
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
#! /usr/bin/env python | |
import os | |
import sys | |
import re | |
import tempfile | |
def getVideoDetails(filepath): | |
tmpf = tempfile.NamedTemporaryFile() | |
os.system("ffmpeg -i \"%s\" 2> %s" % (filepath, tmpf.name)) | |
lines = tmpf.readlines() |
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
from contextlib import contextmanager | |
@contextmanager | |
def slot_disconnected(signal, slot): | |
""" | |
Create context to perform operations with given slot disconnected from | |
given signal and automatically connected afterwards. | |
usage: |
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
tell application "Notes" | |
set theNotes to every note of the folder "Notes" | |
repeat with thisNote in theNotes | |
set myTitle to the name of thisNote | |
set myText to the body of thisNote | |
set myCreateDate to the creation date of thisNote | |
set myUpdateDate to the modification date of thisNote | |
tell application "Evernote" | |
set theTransferredNote to create note with html myText ¬ | |
title myTitle ¬ |
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
// ==UserScript== | |
// @name Github remove relative date stupidness | |
// @namespace http://www.wilcoxd.com | |
// @include https://github.com* | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
// created: WD-rpw 03-25-2013 |
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
--[[! | |
-- @return The current time in UTC | |
--]] | |
function gmtime() | |
return os.time(os.date("!*t")); | |
end |
OlderNewer