Skip to content

Instantly share code, notes, and snippets.

View djeraseit's full-sized avatar
🎯
Focusing

Theodis Butler djeraseit

🎯
Focusing
View GitHub Profile
@zliuva
zliuva / gist:1084476
Last active August 20, 2024 10:32
A minimal Mach-o x64 executable for OS X
; A minimal Mach-o x64 executable for OS X (also see below Mountain Lion version)
;
; $ nasm -f bin -o tiny_hello tiny_hello.s
; $ chmod +x tiny_hello
; $ ./tiny_hello
; Hello World!
; $
; c.f.
; http://osxbook.com/blog/2009/03/15/crafting-a-tiny-mach-o-executable/ ( the original tiny mach-o executable )
@afriza
afriza / redsocks.conf
Created July 21, 2011 13:42
Setup iptables for RedSocks in OpenWRT
base {
// debug: connection progress & client list on SIGUSR1
log_debug = on;
// info: start and end of client session
log_info = on;
/* possible `log' values are:
* stderr
* file:/path/to/file
@robinsmidsrod
robinsmidsrod / pxelinux.ipxe
Created February 21, 2012 14:11
Simple hard-coding of PXELinux config file location
#!ipxe
dhcp
set 210:string http://10.1.0.1/pxe/
set 209:string pxelinux.cfg/${mac:hexhyp}
set filename ${210:string}pxelinux.0
chain ${filename} || exit
@robinsmidsrod
robinsmidsrod / ubuntu-amd64-installer.ipxe
Created March 27, 2012 08:52
Boot Ubuntu x64 installer directly from the network. Only iPXE needed
#!ipxe
dhcp
echo Starting Ubuntu x64 installer for ${hostname}
set base-url http://archive.ubuntu.com/ubuntu/dists/lucid/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64
kernel ${base-url}/linux
initrd ${base-url}/initrd.gz
#imgargs linux auto=true url=http://yourserver/some/path/preseed.cfg
boot ||
# If everything failed, give the user some options
echo Boot from ${base-url} failed
@troy
troy / send_remote_syslog.php
Last active April 6, 2023 18:19
Send UDP remote syslog message from PHP (RFC 3164)
# replace PAPERTRAIL_HOSTNAME and PAPERTRAIL_PORT
# see http://help.papertrailapp.com/ for additional PHP syslog options
function send_remote_syslog($message, $component = "web", $program = "next_big_thing") {
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
foreach(explode("\n", $message) as $line) {
$syslog_message = "<22>" . date('M d H:i:s ') . $program . ' ' . $component . ': ' . $line;
socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, PAPERTRAIL_HOSTNAME, PAPERTRAIL_PORT);
}
socket_close($sock);
@robinsmidsrod
robinsmidsrod / _INSTALL.md
Last active November 7, 2024 12:23
Bootstrapping full iPXE native menu with customizable default option with timeout (also includes working Ubuntu 12.04 preseed install)

Add the following chunk to your existing ISC dhcpd.conf file.

if exists user-class and ( option user-class = "iPXE" ) {
    filename "http://boot.smidsrod.lan/boot.ipxe";
}
else {
    filename "undionly.kpxe";
}

(or see https://gist.github.com/4008017 for a more elaborate setup

@pkmishra
pkmishra / MTOMSoapClient.php
Created March 29, 2012 19:57
PHP SOAP client to handle mtom message encoding
/**
* This client extends the ususal SoapClient to handle mtom encoding. Due
* to mtom encoding soap body has test apart from valid xml. This extension
* remove the text and just keeps the response xml.
*/
class MTOMSoapClient extends SoapClient {
public function __doRequest($request, $location, $action, $version, $one_way = 0) {
$response = parent::__doRequest($request, $location, $action, $version, $one_way);
//if resposnse content type is mtom strip away everything but the xml.
@pklaus
pklaus / etc_firewall.ipv6net.sh
Created April 12, 2012 22:34
Firewall Rules for IPv6 on OpenWrt via Tunnels
#!/bin/ash
# Found on https://forum.openwrt.org/viewtopic.php?pid=135197
#
# Some important definitions used by this script.
# Only edit these in case something has changed and if you know
# what you are doing.
#
# IPT6: path to the ip6tables binary
@robinsmidsrod
robinsmidsrod / gist:2374618
Created April 13, 2012 06:59
Legacy iPXE drivers that need rewriting
# Created with this command:
# src/util/gen_supported_nic_list.pl --format csv --sort legacy_api,bus,file --columns legacy_api,bus,file | uniq | grep '^yes' | perl -F, -lane 'print "$F[1],$F[2]"'
# Available from https://github.com/robinsmidsrod/ipxe/tree/supported_nic_list until included in mainline
isa,src/drivers/net/3c509-eisa.c
isa,src/drivers/net/3c509.c
isa,src/drivers/net/3c515.c
isa,src/drivers/net/3c529.c
isa,src/drivers/net/cs89x0.c
isa,src/drivers/net/depca.c
isa,src/drivers/net/eepro.c
@robinsmidsrod
robinsmidsrod / gist:2471385
Created April 23, 2012 14:48
MS-DOS 6.22 install to iSCSI with iPXE
Apr 23 16:44:20 testvm ipxe: ok
Apr 23 16:44:20 testvm ipxe: net0: 10.1.1.29/255.255.255.0 gw 10.1.1.1
Apr 23 16:44:20 testvm ipxe: Next server: 10.1.1.2
Apr 23 16:44:20 testvm ipxe: Filename: http://server.smidsrod.lan/tftp/pxeboot.cgi
Apr 23 16:44:20 testvm ipxe: http://server.smidsrod.lan/tftp/pxeboot.cgi...Downloaded "pxeboot.cgi"
Apr 23 16:44:20 testvm ipxe: ok
Apr 23 16:44:20 testvm ipxe: Executing "pxeboot.cgi"
Apr 23 16:44:20 testvm ipxe: Loading PXE script for 08:00:27:ea:c2:76
Apr 23 16:44:20 testvm ipxe: http://server.smidsrod.lan/tftp/pxeboot.cgi?uuid=f84a339b-9e36-456e-8ccf-4c51ea6cb42d&mac=08%3A00%3A27%3Aea%3Ac2%3A76&busid=01%
Apr 23 16:44:20 testvm ipxe: 3A80%3A86%3A10%3A04&ip=10.1.1.29&hostname=testvm&serial=0&asset=&manufacturer=innotek%20GmbH&product=VirtualBox...Downloaded "p