View christmas_weekend_dates.py
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 datetime import datetime, timedelta, date | |
dates = [] | |
today = datetime.today() | |
years = ["25/12/%d" % x for x in xrange(today.year, today.year + 101) if date(x, 12, 25).weekday() == 3] | |
print years |
View .gitignore
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
# Ignore files | |
*.pyc | |
*.pyo | |
*.db | |
*.log | |
*.swp | |
*.swo | |
*~ | |
*.orig | |
*.eggs |
View postgress-install.sh
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/bash | |
# Install postgress server locally | |
sudo apt-get install postgresql postgresql-contrib | |
# Install PostGIS, procedural languages, client interfaces, etc | |
sudo apt-cache search postgres | |
# Install PGAdmin or Postgres UI, which is similar to PHPMyAdmin. | |
sudo apt-get install pgadmin3 |
View binary_search.py
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 binary_search(lst, comparator): | |
"""Perform a binary search of the given list based on the given comparator | |
Arguments: | |
lst (list): | |
List of items to search through. | |
comparator (function): | |
Reference pointer for the function or method. This function should | |
only accept one parameter which is a signle list item. In addition, | |
this function should return a boolean value or none. |
View python_node_bower_package_install.sh
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/bash | |
function base_installer { | |
# Install virtualenv | |
if [ -z $(which virtualenv) ]; then \ | |
sudo apt-get install python-virtualenv; \ | |
fi | |
# Create virtualenv for project | |
if [ ! -e "bin/pip" ]; then \ | |
virtualenv . |
View ctolabel.js
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
//new chart type LineBar - its a bit like bar and line were slammed together at high speed, not pretty, but they are part of each other now | |
(function(){ | |
"use strict"; | |
var root = this, | |
Chart = root.Chart, | |
helpers = Chart.helpers; | |
var defaultConfig = { |
View install_appengine.sh
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/bash | |
APPENGINE_PATH=/usr/local/google_appengine | |
APPENGINE_APPCFG=/usr/local/google_appengine/appcfg.py | |
APP_PATH=$(pwd) | |
USER=$(whoami) | |
USER_HOME=/home/${USER} | |
APPENGINE_DLOAD=${USER_HOME}/google_appengine_1.9.37.zip | |
if [ -z $(which curl) ]; then \ |
View subprocess.php
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
<?php | |
/** | |
* @author Ashraf M Kaabi | |
* @name Advance Linux Exec | |
*/ | |
class Process { | |
/** | |
* Run Application in background | |
* | |
* @param unknown_type $Command |
View importer.py
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
################################################################ | |
# Poor men's Plone export | |
# (C) 2013, ZOPYX Ltd, D-72074 Tuebingen | |
################################################################ | |
import os | |
import shutil | |
import tempfile | |
import glob | |
import transaction |
View Regex.txt
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 re | |
>>> data = """1foo bar | |
... 2bing baz | |
... 3spam eggs | |
... nomatch | |
... """ | |
>>> pattern = r"(.)(\w+)\s(\w+)" | |
>>> {x[0]: x[1] for x in (m.group(3, 2) for m in (re.search(pattern, line) for line in data.splitlines()) if m)} | |
{'baz': 'bing', 'eggs': 'spam', 'bar': 'foo'} | |
share improve t |