Skip to content

Instantly share code, notes, and snippets.

View dwurf's full-sized avatar

Darren Wurf dwurf

  • Australia
View GitHub Profile
@dwurf
dwurf / hello.svg
Created September 6, 2020 05:45
Half a submission for the pycon 2020 Rube Codeberg challenge - unfinished
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dwurf
dwurf / sendfile.py
Created December 15, 2019 22:44
Using Python's built-in smtplib to send files
#!/usr/bin/env python
"""Script for sending an email (with an optional file attachment)."""
# Modified from the documentation at
# https://docs.python.org/2/library/email-examples.html
#
# Tested against python 2.6, 2.7 and 3.6
#
# For help, run this script!
@dwurf
dwurf / Makefile
Last active September 13, 2019 13:10
Query Valve servers
.PHONY: run
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
pth := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
run: $(pth)/venv
$(pth)/venv/bin/python3 $(pth)/query.py
$(pth)/venv:
@dwurf
dwurf / go.mod
Last active September 1, 2019 02:28
Go web server - hello world!
module https://gist.github.com/dwurf/25d26181b407a58ab8a67e824675e487
@dwurf
dwurf / keybase.md
Created April 24, 2018 10:30
keybase.md

Keybase proof

I hereby claim:

  • I am dwurf on github.
  • I am dwurf (https://keybase.io/dwurf) on keybase.
  • I have a public key ASDQJHM8GNRuzcosO3uRNIX6hvy5qDyjKLpms2GMATU8vAo

To claim this, I am signing this object:

@dwurf
dwurf / tcp_client.py
Created March 20, 2017 23:38
TCP client/server code in Python (asyncore library)
#!/usr/bin/env python
# This script opens CONNECTIONS simultaneous connections to a remote socket,
# and sends a fixed string before closing the connection. The process is then
# repeated indefinitely
# Intended to unit test the tcp_server.py script
import asyncore
import socket
@dwurf
dwurf / slides.md
Last active February 28, 2016 09:30
Practical Use of Docker
## Docker

Docker is a useful abstraction for processes

  • Web application server (django/rails/tomcat/...)
  • Database
  • Reverse HTTP proxy (nginx/apache)

... each in their own Docker container

@dwurf
dwurf / cyclobs.cpp
Created January 13, 2016 10:00
Program to solve cyclobs' weird problem
#include <iostream>
#include <cstdlib>
using namespace std;
// Arbitrary precision c++ library
// compile with:
// gcc thisfile.c -lgmp -lgmpxx -o mybinary
#include <gmpxx.h>
int main(int argc, char **argv){
@dwurf
dwurf / setup.md
Last active October 26, 2015 11:42
Docker setup

These steps were run to set up the local network

Docker install

sudo apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo bash -c "echo deb https://apt.dockerproject.org/repo ubuntu-trusty main > /etc/apt/sources.list.d/docker.list"
sudo apt-get update
sudo apt-get -y install docker-engine
sudo docker run hello-world

sudo docker run -it ubuntu bash

#!/bin/bash
# Script to install kf2 server under wine on ubuntu 14.04 (AWS micro instance)
# This script makes a mess, run it in a subdirectory to keep it contained
# Also run it on a server you don't care about or be sure you don't mind when it
# installs a bunch of random crap
# Install wine
if dpkg -l wine > /dev/null 2>/dev/null; then