Skip to content

Instantly share code, notes, and snippets.

View pdxjohnny's full-sized avatar
🐢
Rolling Alice...

John Andersen pdxjohnny

🐢
Rolling Alice...
View GitHub Profile
@lawliet89
lawliet89 / gist:5899943
Created July 1, 2013 10:55
Git grep for trailing whitespace
git grep -I -E '^.+[ ]+$'
@cwacek
cwacek / cobbler-uefi-pxe-rhel.md
Last active January 17, 2022 21:26
A description of how to make Cobbler, PXE, and UEFI behave for Red Hat Enterprise Linux 6 installations

UEFI PXE Installation of RHEL6.4

For some reason, starting a PXE boot installation of RHEL6.4 on UEFI systems is poorly documented. Simultaneously, the process is not terribly verbose when it fails. Here's what I had to do to get this to work.

We going to use Cobbler to take care of a lot of the gruntwork (TFTP, DHCP, etc). It's entirely possible to do it without Cobbler, but even accounting for its warts it will make you more

@kr
kr / jsonenv
Created August 6, 2013 00:59
convert a json dictionary into environment variables
#!/usr/bin/env python
# jsonenv reads a json object as input and produces
# escaped shell commands for setting environment vars
import json
import pipes
import sys
for k, v in json.load(sys.stdin).items():
@JalfResi
JalfResi / revprox.go
Last active May 18, 2024 00:23
Simple reverse proxy in Go
package main
import(
"log"
"net/url"
"net/http"
"net/http/httputil"
)
func main() {
@ryancdotorg
ryancdotorg / dnaas.c
Created October 30, 2013 23:20
Wrapper library to use /dev/null as a service on Linux via LD_PRELOAD
/* This is a wrapper library that will give your server the power of
* /dev/null as a service, as seen at http://devnull-as-a-service.com/
*
* Compile:
* gcc -ggdb -shared -fPIC dnaas.c -ldl -lcurl -o libdnaas.so
*
* Try:
* LD_PRELOAD=./libdnaas.so dd if=/dev/sda of=/dev/null bs=8192 count=16
*
* Install:
@nhoad
nhoad / gist:8966377
Last active March 2, 2023 09:30
Async stdio with asyncio
import os
import asyncio
import sys
from asyncio.streams import StreamWriter, FlowControlMixin
reader, writer = None, None
@asyncio.coroutine
def stdio(loop=None):
@cee-dub
cee-dub / sse.go
Created May 30, 2014 21:08
Simple Golang SSE example using CloseNotifier
package main
import (
"fmt"
"log"
"net/http"
"time"
)
// SSE writes Server-Sent Events to an HTTP client.
@jpillora
jpillora / sshd.go
Last active December 17, 2023 16:27
Go SSH server complete example - Read more here https://blog.gopheracademy.com/go-and-ssh/
// A small SSH daemon providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client:
@enten
enten / contributors.sh
Created August 23, 2015 17:52
Create MAINTAINERS file from git commits
#!/bin/sh
# contributors: Generate MAINTAINERS content from git commits
#
# Author: Steven Enten <steven@enten.fr>
# License : MIT
# Requirements: dirname cat echo eval grep read readlink shift tail
# Site: https//github.com/enten/losh
set -u
@julz
julz / main.go
Created November 20, 2015 12:39
containersched minicontainer
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
func main() {