Skip to content

Instantly share code, notes, and snippets.

@paulmach
paulmach / serve.go
Last active January 26, 2025 18:27
Simple Static File Server in Go
/*
Serve is a very simple static file server in go
Usage:
-p="8100": port to serve on
-d=".": the directory of static files to host
Navigating to http://localhost:8100 will display the index.html or directory
listing file.
*/
package main
@petri
petri / gist:7210268
Created October 29, 2013 07:14
Some programs such as ssh ask for password and key passphrase via tty, which is not supported by subprocess.Popen. This example illustrates use of pty.fork() to support communications with a child process via a tty (a pty, actually).
"Run git clone using pki key with passphrase."
import pty, os, sys, select
def waitfor(fd, str):
"poll the child for input"
poll = select.poll()
poll.register(fd, select.POLLIN)
while True:
@s4y
s4y / LICENSE.md
Created August 26, 2011 17:11
For Mac OS X: Get a list of running processes, and tell if a particular process is running, by name

Copyright (c) 2010 DeepTech, Inc.

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 furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE O