Skip to content

Instantly share code, notes, and snippets.

View Druid-of-Luhn's full-sized avatar

Billy Brown Druid-of-Luhn

View GitHub Profile
@Druid-of-Luhn
Druid-of-Luhn / read_line.c
Last active December 18, 2018 09:12
Portable C function to read a line from a file
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BUF_SIZE 512
size_t next_buffer(const size_t buffer, const size_t count)
{
return (buffer + 1) % count;
}
@Druid-of-Luhn
Druid-of-Luhn / bitcompress.c
Last active November 28, 2018 17:39
C bit compression
#include <stdlib.h>
#include <stdio.h>
#define BYTE_SIZE 8
size_t compress_code(const int *code, const size_t code_length, unsigned char **compressed)
{
if (code == NULL || code_length == 0 || compressed == NULL) {
return 0;
}
@Druid-of-Luhn
Druid-of-Luhn / pylogo.py
Created June 1, 2015 11:13
PyLogo is a lightweight library that uses PyGame to provide a LOGO-like drawing interface for Python, to provide a simple and fun way to learn programming in Python.
"""
PyLogo is a lightweight library that uses PyGame to provide a LOGO-like
drawing interface for Python, to provide a simple and fun way to learn
programming in Python.
"""
import pygame
from math import cos, radians, sin
# Functions that 'from pylogo import *' exports
@Druid-of-Luhn
Druid-of-Luhn / cloth-bg.css
Created August 27, 2012 17:21
Grungy cloth texture CSS background
.cloth-bg {
background: #777;
background: -webkit-radial-gradient(rgba(0, 0, 0, 0.1) 50%, rgba(255, 255, 255, 0.1) 50%),
-webkit-linear-gradient(45deg, rgba(50, 50, 50, 0.95), rgba(200, 200, 200, 0.95)),
url('http://f.cl.ly/items/3h0j172n2i3q1z0t2G1P/noise.jpg');
background-size: 3px 3px,
auto auto,
auto auto;
}