Skip to content

Instantly share code, notes, and snippets.

adejones /
Created Feb 21, 2017
Script for Wine app using XQuartz. Open up Apple's Script Editor * Edit the program per the directions in the lines that start with -- * if everything is default, you only need to edit the "set toRun" line * After you have edited it for your program, save it as an "Application" (not a script) in the script editor * this will create a .app for yo…
on run
--edit this to be the correct location and file to run (typically only edit after the "drive_c")
set toRun to "$WINEPREFIX/drive_c/Program Files/MyProgram/MyProgramName.exe"
--edit winePrefix if you are not using the default prefix
set winePrefix to "$HOME/.wine"
--edit wineLocation if your wine install is not the default location
set wineLocation to "/usr/local/bin"
#!/usr/bin/env python
# Name:
# Purpose: Write log using TimedRotatingFileHandler
# Author: Adrian Jones
# Created: 2012-05-25
# TimedRotatingFileHandler: from source:
# Current 'when' events supported:
# S - Seconds
import logging
import logging.handlers
# log file name and logging message level
log_file_name = 'loggingexample.log'
log_level = logging.INFO
# log record format string
format_string = '%(asctime)s %(name)s %(levelname)s %(message)s'
import logging
# change default log entry format, set filename and logging level
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s", filename="example.log")"Started")"This is an example entry")
logging.debug("This line won't get logged as the log level is INFO")"Done.")
# perform an orderly shutdown by flushing and closing all handlers; called at application exit and no further use of the logging system should be made after this call.
adejones /
Last active Jan 27, 2020 — forked from RWJMurphy/
Python class and utility for file rotation. Configurable daily, weekly and monthly retention; can use hard links to save space; supports `argparse` config files.
#!/usr/bin/env python3
# vim: ft=python ts=4 sw=4 expandtab
# Copyright (c) 2013 Reed Kraft-Murphy <>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
View Create new Mercurial repository from a sub directory of an existing repository.bat
rem cd to the full repo directory
cd path\to\full_repo
rem export tracked files in sub directory by creating a filemap using an intermediary temp file
set SUBDIR=name_of_subdir
hg locate -I "%SUBDIR%" > ..\filemap.tmp
for /f "tokens=*" %A in (..\filemap.tmp) do @echo include %A >> ..\filemap.txt
echo rename "%SUBDIR%" . >> ..\filemap.txt
del ..\filemap.tmp
View Create new Mercurial repository from a sub directory of an existing
# cd to the full repo directory
cd path/to/full_repo
# export tracked files in sub directory by creating a filemap
export SUBDIR=name_of_subdir
hg locate -I "$SUBDIR" | awk '{print "include \"" $1 "\"";}' > ../filemap.txt
echo "rename \"$SUBDIR\" ." >> ../filemap.txt
# create new repo using filemap
hg convert --filemap ../filemap.txt . ../new_repo_name
adejones /
Last active Nov 26, 2015
Check a mount point on Linux, attempt some recovery if the directory contains files then attempt mount -a
#!/usr/bin/env sh
# check if share is mounted, attempt recovery and remount
if [ -z "$1" ]; then
echo "Usage: $0 /mount/point/to/check"
exit 0
You can’t perform that action at this time.