Skip to content

Instantly share code, notes, and snippets.

John Maguire JohnMaguire

Block or report user

Report or block JohnMaguire

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View .zshrc
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="candy"
# Example aliases
View alsa-info.txt.jaaTB5QBbF
upload=true&script=true&cardinfo=
!!################################
!!ALSA Information Script v 0.4.63
!!################################
!!Script ran on: Thu Aug 7 08:56:44 UTC 2014
!!Linux Distribution
!!------------------
View battery_warn
#!/bin/bash
# Configuration
interval=60 # in seconds
critical_level=19 # percentage
icon="/usr/share/icons/Tango/48x48/devices/battery.png" #notification icon
notification_interval=30000
while true
do
View set-display
#!/bin/bash
function check_display {
xrandr | egrep "^$@ connected" >& /dev/null
local status=$?
if [ $status -ne 0 ]; then
return 1
else
return 0
fi
View set-display
#!/bin/bash
function check_display {
xrandr | egrep "^$@ connected" >& /dev/null
local status=$?
if [ $status -ne 0 ]; then
return 1
else
return 0
fi
@JohnMaguire
JohnMaguire / gist:1702eb53dcd11166d356
Created Dec 8, 2014
Info-ZIP Information for spynot-systems.zip
View gist:1702eb53dcd11166d356
Archive: C:\Users\win7-jmaguire\Downloads\spynot-systems.zip 1598799 71
End-of-central-directory record:
-------------------------------
Actual offset of end-of-central-dir record: 1598777 (00186539h)
Expected offset of end-of-central-dir record: 1598777 (00186539h)
(based on the length of the central directory and its expected offset)
This zipfile constitutes the sole disk of a single-part archive; its
@JohnMaguire
JohnMaguire / gist:f026a90b2df31672953b
Created Dec 17, 2014
Calculate next payday (1st / 16th, or the business day previous if a weekend) in Google Sheets
View gist:f026a90b2df31672953b
IF(
WEEKDAY(
IF(
DAY(NOW()) >= 16,
DATE(YEAR(EDATE(NOW(), 1)), MONTH(EDATE(NOW(), 1)), 1),
DATE(YEAR(NOW()), MONTH(NOW()), 16)
)
) = 1,
IF(
DAY(NOW()) >= 16,
@JohnMaguire
JohnMaguire / gist:5b53d1c0f3ccac12d0c4
Created Jan 5, 2015
Configuring NAT port-forwarding w/ VMware Fusion
View gist:5b53d1c0f3ccac12d0c4
jmaguire@ZimsBase [01:55:54] [/Library/Preferences/VMware Fusion/vmnet8]
-> % sudo vim nat.conf
jmaguire@ZimsBase [01:56:17] [/Library/Preferences/VMware Fusion/vmnet8]
-> % sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --stop
Stopped DHCP service on vmnet1
Disabled hostonly virtual adapter on vmnet1
Stopped DHCP service on vmnet8
Stopped NAT service on vmnet8
Disabled hostonly virtual adapter on vmnet8
Stopped all configured services on all networks
@JohnMaguire
JohnMaguire / gist:45b8153a9ad29e306da8
Created Feb 28, 2015
Why is it not a weak reference?
View gist:45b8153a9ad29e306da8
Python 2.7.9 (default, Dec 19 2014, 06:00:59)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foobar(object):
... def foo():
... print "Called"
...
>>> a = Foobar()
>>> a.foo
<bound method Foobar.foo of <__main__.Foobar object at 0x10a1de510>>
@JohnMaguire
JohnMaguire / plugin_runner.py
Last active Aug 29, 2015
An idea for a forking Plugin Runner for Cardinal
View plugin_runner.py
import os
import sys
import time
import signal
class PluginRunner(object):
pid = False
parent_pid = False
def __init__(self, plugin):
self.pid = os.getpid()
You can’t perform that action at this time.