Skip to content

Instantly share code, notes, and snippets.

# Config file for macfanctl daemon
#
# Note: 0 < temp_X_floor < temp_X_ceiling
# 0 < fan_min < 6200
fan_min: 2000
temp_max_floor: 60
temp_max_ceiling: 90
temp_max_fan_min: 4000
@detly
detly / gist:2ca59e57ffe177e1ad77
Created March 15, 2015 10:57
pexpect.ANSI demo
#!/usr/bin/env python2
"""
Copyright (c) 2015, Jason Heeris
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
"""
import fcntl
#!/usr/bin/env python2
import subprocess
import time
# Start 'top'
the_proc = subprocess.Popen(['top'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# Just kill it after a couple of seconds
time.sleep(2)
the_proc.terminate()
#!/usr/bin/env python3
import sys
import time
def main():
while True:
sys.stdout.write('\x1b[2J')
sys.stdout.write('\r\n')
sys.stdout.write('test')
sys.stdout.write('\r\n')
#!/usr/bin/env python3
import sys
import pexpect
def callback(state):
data = state['child'].before + state['child'].after
print("Got: {:s}".format(repr(data)))
def main():
cmd = ' '.join([
#!/usr/bin/env python3
import asyncio
import sys
import pexpect
@asyncio.coroutine
def run():
cmd = ' '.join([
sys.executable,
'pexpect_bug_script.py'
#!/usr/bin/env python3
import asyncio
import sys
import pexpect
@asyncio.coroutine
def run():
cmd = ' '.join([
sys.executable,
'-c \'raise SystemExit("Blorp")\''
#!/usr/bin/env python3
import sys
import pexpect
def main():
cmd = ' '.join([
sys.executable,
'-c \'raise SystemExit("Blorp")\''
])
# Synergy Client
#
# Starts the synergy client when an X session is up and running.
# This should be placed in /etc/init/synergys.conf and there must
# be a configuration file in /etc/synergy/synergys.conf.
description "Synergy Server"
author "Jason Heeris <jason.heeris@gmail.com>"
start on ((login-session-start
section: screens
jheer-macmini:
halfDuplexCapsLock = false
halfDuplexNumLock = false
halfDuplexScrollLock = false
xtestIsXineramaUnaware = false
switchCorners = none
switchCornerSize = 0
JHEER-LAPTOP1:
halfDuplexCapsLock = false