Skip to content

Instantly share code, notes, and snippets.

// This: https://www.rabbitmq.com/tutorials/tutorial-one-go.html
// But without all the copied code between send and receive :)
package main
import (
"os"
"log"
"strings"
"github.com/streadway/amqp"
@jtickle
jtickle / hilbert-term.py
Last active May 7, 2019 18:05
Hilbert Terminal Filling Curve
#!/usr/bin/env python3
import shutil;
import collections;
import math;
import sys;
import argparse;
Point = collections.namedtuple('Point', ['x', 'y', 'n'])
HilbertAt = collections.namedtuple('HilbertAt', ['x', 'y', 'n'])
@jtickle
jtickle / ftw.c
Created January 3, 2017 02:05
Fourier transform
#include <fftw3.h>
#include <math.h>
#define N 256
// This thing does a fourier transform on a generated array of data
// and makes a CSV out of it so I could make pretty graphs in an
// outside tool.
//
// in the output:
@jtickle
jtickle / GeodesicSphere.js
Created September 4, 2016 16:25 — forked from Inscrutabilis/GeodesicSphere.js
Three.js geodesic sphere primitive class
/**
* @author Inscrutabilis / mailto:[email protected]
*/
/*
* Generates a geodesic sphere geometry
* By default, it is 1x1x1 octahedron, as a first approximation to sphere
* It will return more sphere-like object if you specify iterations > 0
* But please keep in mind that it generates (4 ^ iterations) * 8 faces
* Radius argument overrides default sphere radius (1)
@jtickle
jtickle / ipaddr.sh
Created February 11, 2015 01:13
Parses 'ip addr' and shows you what you are really looking for - IP per interface.
ip -o -4 addr | awk '/.* ([a-zA-Z0-9]+)/ {print $2 "\t" $4}'
ticklejw@MAL ~
$ find test -exec ./sleepawhile {} \; -type f -print
Sleeping for 1 second... done!
Sleeping for 1 second... done!
test/0
Sleeping for 1 second... done!
test/1
Sleeping for 1 second... done!
test/2
Sleeping for 1 second... done!
#!/usr/bin/env sh
# This script will display a count of the arguments passed to it,
# once each time it is called by xargs.
#
# To show how xargs works:
#
# seq 1 1000000 | xargs ./count-args
echo Called once by xargs with $# arguments.
@jtickle
jtickle / older.sh
Last active August 29, 2015 13:59
BASH "Older Than" Script
#!/bin/bash
# This script will return 0 if the specified file is older, 1 if newer than the specified date.
# Intended for use with GNU Find, like so:
#
# find filez/ -exec ./older.sh {} "2 days ago 00:00" + -delete
#
# If you want to find files that are newer than 2 days ago, you'd do something like:
#
# find filez/ -not -exec ./older.sh {} "2 days ago 00:00" + -delete
@jtickle
jtickle / Better GFMC Idea
Last active August 29, 2015 13:57
Better GFMC idea
```
namespace My\Shitty;
use \Exception;
```
# Class: Thing
It is a thing that holds stuff. Takes an array in the constructor in which to put stuff; doesn't care if it's empty or not.
```
@jtickle
jtickle / gist:9419951
Last active August 29, 2015 13:57
Compilable and Interpretable GFM
# Hello Class
This class exposes an interface "sayHello" that says hello.
If someone wrote a utility called 'gfmc', it would be a compiler that compiles whatever you put in code blocks in whatever language you specified and puts them in sensible places.
I don't think this is actually possible but you get the idea. It may not have any value at all, but then again it might if you want to make an API to your thing in every language anyone's ever heard of.
```php
class Hello {