Skip to content

Instantly share code, notes, and snippets.

View trungly's full-sized avatar

Trung Ly trungly

View GitHub Profile
@trungly
trungly / gist:3c47d53e29ba51cd5c30cef48b88347e
Created August 11, 2022 22:05
com.googlecode.iterm2.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AlternateMouseScroll</key>
<true/>
<key>Default Bookmark Guid</key>
<string>40A6CA28-E364-496A-A5EF-48313DA0FD67</string>
<key>HapticFeedbackForEsc</key>
<false/>
0x00169c5059a511c55a659f6ed849ED4DbeF9457A
@trungly
trungly / simple_server.py
Last active February 1, 2024 18:51
A simple Python HTTP server that supports a GET that echoes some request data and a POST that reads a request body, parses it as JSON and responds with part of the data
from BaseHTTPServer import BaseHTTPRequestHandler
import urlparse, json
class GetHandler(BaseHTTPRequestHandler):
def do_GET(self):
parsed_path = urlparse.urlparse(self.path)
message = '\n'.join([
'CLIENT VALUES:',
'client_address=%s (%s)' % (self.client_address,
def waitFor(Double timeoutSecs = 5, Double intervalSecs = 0.5, Closure condition) {
intervalSecs = [timeoutSecs, intervalSecs].min()
def loops = Math.ceil(timeoutSecs / intervalSecs)
def pass = condition()
def i = 0
while (!pass && i++ < loops) {
Thread.sleep((intervalSecs * 1000) as long)
pass = condition()