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
#https://stackoverflow.com/questions/1345827/how-do-i-find-the-time-difference-between-two-datetime-objects-in-python | |
>>> import datetime | |
>>> a = datetime.datetime.now() | |
>>> b = datetime.datetime.now() | |
>>> c = b - a | |
datetime.timedelta(0, 8, 562000) | |
>>> divmod(c.days * 86400 + c.seconds, 60) | |
(0, 8) # 0 minutes, 8 seconds |
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
#https://github.com/skepticli/tutorial-screencast-to-gif | |
#command line | |
mkdir frames | |
ffmpeg -i my-screencast.mov -r 3 frames/image.%03d.png | |
#At this point it might be useful to go into your frames | |
#directory and delete extra images, most likely frames at | |
#the start and end of your video/gif |
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
#county | |
right( ('000' || tostring( "myfield" )), 4) | |
#state | |
right( ('0' || tostring( "fips" )), 2) |
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
case when "Some_Value" IS NULL then 0 else "Some_Value" 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
ffmpeg -i CAPITOJINX.wav -f mp3 capitojinx.mp3 |
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
state | county | |
---|---|---|
Alabama | Bibb | |
Alabama | Blount | |
Alabama | Calhoun | |
Alabama | Chambers | |
Alabama | Cherokee | |
Alabama | Chilton | |
Alabama | Clay | |
Alabama | Cleburne | |
Alabama | Colbert |
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 sys import argv | |
import datetime, os, logging | |
from django.core.management.base import BaseCommand, CommandError | |
class Command(BaseCommand): | |
def handle(self, *args, **options): | |
self.print_date() | |
def print_date(self): |
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
# Thanks to http://stackoverflow.com/questions/9884353/xls-to-csv-convertor | |
import os, csv, xlrd | |
excel_file = '/path/to/file.xls' | |
#we're specifying a directory here because we'll have several files | |
#be sure to include end slash | |
csv_filepath = 'path/to/csv/directory/' | |
def csv_from_excel(excel_file): | |
workbook = xlrd.open_workbook(excel_file) |
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
RewriteEngine on |
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
# To redirect all users to access the site WITH the 'www.' prefix, | |
# (http://example.com/... will be redirected to http://www.example.com/...) | |
# Make sure to replace example.com with your own site name | |
RewriteCond %{HTTP_HOST} ^example\.com$ [NC] | |
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] |