This file contains hidden or 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
| stashgrep() { | |
| for i in `git stash list | awk -F ':' '{print $1}'`; do | |
| git stash show -p $i | grep -H --label="$i" "$1" | |
| done | |
| } |
This file contains hidden or 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/python | |
| import sys | |
| import argparse | |
| import os | |
| import re | |
| ''' | |
| A simple script to create lower-resolution Android drawables from higher-resolution ones. |
This file contains hidden or 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 urllib2 | |
| import re | |
| import time | |
| import pycurl | |
| import StringIO | |
| #url = "http://78.10.81.103:19100/mbp.html" | |
| url = "http://store.apple.com/pl/browse/home/shop_mac/family/macbook_pro/select" | |
| prev_delivery = (None, None) |
This file contains hidden or 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 -S uv run --script --quiet | |
| # /// script | |
| # requires-python = ">=3.13" | |
| # dependencies = [] | |
| # /// | |
| """A simple python script template. | |
| """ |
This file contains hidden or 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/python2 | |
| import psycopg2 | |
| from datetime import datetime | |
| import pytz, time | |
| tzname = 'UTC' | |
| TZ = pytz.timezone(tzname) | |
| test_datetime = datetime.fromtimestamp(1341446400) | |
This file contains hidden or 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
| # xcode-build-bump.sh | |
| # @desc Auto-increment the build number every time the project is run. | |
| # @usage | |
| # 1. Select: your Target in Xcode | |
| # 2. Select: Build Phases Tab | |
| # 3. Select: Add Build Phase -> Add Run Script | |
| # 4. Paste code below in to new "Run Script" section | |
| # 5. Drag the "Run Script" below "Link Binaries With Libraries" | |
| # 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0) |
This file contains hidden or 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 reltime(date, compare_to=None, at='@'): | |
| r'''Takes a datetime and returns a relative representation of the | |
| time. | |
| :param date: The date to render relatively | |
| :param compare_to: what to compare the date to. Defaults to datetime.now() | |
| :param at: date/time separator. defaults to "@". "at" is also reasonable. | |
| >>> from datetime import datetime, timedelta | |
| >>> today = datetime(2050, 9, 2, 15, 00) | |
| >>> earlier = datetime(2050, 9, 2, 12) |
This file contains hidden or 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 django.contrib.admin import FieldListFilter | |
| from django.utils.translation import ugettext as _ | |
| class ActiveValueFilter(FieldListFilter): | |
| """list_filter which displays only the values for a field which are in use | |
| This is handy when a large range has been filtered in some way which means | |
| most of the potential values aren't currently in use. This requires a | |
| queryset field or annotation named "item_count" to be present so it can |
This file contains hidden or 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 unicodecsv | |
| from django.http import HttpResponse | |
| def export_as_csv_action(description="Export selected objects as CSV file", | |
| fields=None, exclude=None, header=True): | |
| """ | |
| This function returns an export csv action | |
| 'fields' and 'exclude' work like in django ModelForm | |
| 'header' is whether or not to output the column names as the first row | |
| """ |
This file contains hidden or 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
| # Orignal version taken from http://www.djangosnippets.org/snippets/186/ | |
| # Original author: udfalkso | |
| # Modified by: Shwagroo Team and Gun.io | |
| import sys | |
| import os | |
| import re | |
| import hotshot, hotshot.stats | |
| import tempfile | |
| import StringIO |