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
launch "iTerm" | |
tell application "iTerm" | |
set dev_directory to "path/to/your/project" | |
set django_port to "8000" | |
tell the current terminal | |
activate current session | |
launch session "Default Session" |
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
@task | |
def del_pyc(): | |
""" | |
Delete *.pyc of your project | |
""" | |
local('find . -name \*.pyc | xargs rm') |
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
#!/bin/zsh | |
cd templates | |
find . -type f -print0 | xargs -0 sed -i '' 's/ url \([^" >][^ >]*\)/ url "\1"/g' |
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 | |
#---------------------------------------------------------- | |
# Create backups using snapshops | |
#---------------------------------------------------------- | |
from datetime import datetime | |
import os | |
# Directory for backups |
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
'handlers': { | |
'stream': { | |
'level': 'DEBUG', | |
'class': 'logging.StreamHandler', | |
} | |
} | |
'loggers': { | |
'': { | |
'handlers': ['stream'], |
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
CREATE DATABASE dbname DEFAULT CHARACTER SET utf8; | |
GRANT ALL PRIVILEGES ON dbname.* TO 'db_user'@'localhost' IDENTIFIED BY 'passwd_user'; |
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
def humanize_seconds(seconds, granularity=2): | |
intervals = ( | |
('weeks', 604800), # 60 * 60 * 24 * 7 | |
('days', 86400), # 60 * 60 * 24 | |
('hours', 3600), # 60 * 60 | |
('minutes', 60), | |
('seconds', 1), | |
) | |
result = [] |
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
CREATE ROLE username LOGIN ENCRYPTED PASSWORD 'password' NOINHERIT; | |
CREATE DATABASE db WITH ENCODING='UTF-8' OWNER=username; |
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 = require 'https' | |
url = 'https://hacker-news.firebaseio.com/v0/topstories.json' | |
base_item_url = 'https://hacker-news.firebaseio.com/v0/item/' | |
pattern = /python|django/i | |
https.get url, (res) -> | |
res.on 'data', (codes) -> | |
for code in JSON.parse(codes) |
OlderNewer