Skip to content

Instantly share code, notes, and snippets.

Avatar

Darren Wurf dwurf

  • Australia
View GitHub Profile
@dwurf
dwurf / hello.svg
Created Sep 6, 2020
Half a submission for the pycon 2020 Rube Codeberg challenge - unfinished
View hello.svg
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 Dec 15, 2019
Using Python's built-in smtplib to send files
View sendfile.py
#!/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 Sep 13, 2019
Query Valve servers
View Makefile
.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 Sep 1, 2019
Go web server - hello world!
View go.mod
module https://gist.github.com/dwurf/25d26181b407a58ab8a67e824675e487
View 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 Mar 20, 2017
TCP client/server code in Python (asyncore library)
View tcp_client.py
#!/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 Feb 28, 2016
Practical Use of Docker
View slides.md
## 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 Jan 13, 2016
Program to solve cyclobs' weird problem
View cyclobs.cpp
#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 Oct 26, 2015
Docker setup
View setup.md

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
View kf2_server_setup.sh
#!/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