Skip to content

Instantly share code, notes, and snippets.

@mr1337357
mr1337357 / lookup.c
Created February 7, 2013 23:40
DNS lookup program simply gcc *.c
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <string.h>
#pragma pack(1)
typedef unsigned int u32;
typedef unsigned short u16;
#include <SPI.h>
typedef struct {
uint8_t r;
uint8_t g;
uint8_t b;
} LED;
LED leds[68];
void sendleds(RGB *data) {
int i;
for(i=0;i<68;i++) {
@mr1337357
mr1337357 / peek.c
Last active March 9, 2022 19:19
peek and poke for linux
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
int main(int argc,char **argv) {
int devmem = -1;
unsigned int addr = 0;
unsigned int val = 0;
#include <stdio.h>
int main() {
const int x=5;
int y=6;
(&y)[1]=4;
printf("%d\n",x);
return 0;
}
# Maintainer: Claudio Kozicky <claudiokozicky@gmail.com>
# Contributor: Yann Kaiser <kaiser.yann@gmail.com>
pkgname=jamestown
pkgver=1.0.2
_pkgver=1_0_2
pkgrel=1
pkgdesc="A neo-classical top-down shooter for up to four players set on 17th-century British Colonial Mars."
arch=(i686 x86_64)
url="http://www.finalformgames.com/jamestown/"
# Maintainer: Claudio Kozicky <claudiokozicky@gmail.com>
# Contributor: mr1337357 <mr1337357@gmail.com>
pkgname=jamestown
pkgver=1.0.2
_pkgver=1_0_2
pkgrel=1
pkgdesc="A neo-classical top-down shooter for up to four players set on 17th-century British Colonial Mars."
arch=(i686 x86_64)
url="http://www.finalformgames.com/jamestown/"
@mr1337357
mr1337357 / main.py
Last active August 29, 2015 14:13
Musicgen
#too short to license, so public domain
from wavegen import wavegen
from sys import stdout
import random
def tochar(sample):
sample = sample * 127
sample = sample + 127
sample = int(sample)
return chr(sample)
a = wavegen(440,44100)
@mr1337357
mr1337357 / main.py
Last active August 29, 2015 14:13 — forked from MLLeKander/main.py
#too short to license, so public domain
from wavegen import wavegen
from sys import stdout
import random
def tochar(sample):
return chr(int(sample * 127 + 127))
a = wavegen(440)
ash = wavegen(466.16)
b = wavegen(493.88)
def fib(n,cache={0:1,1:1}):
try:
return cache[n]
except:
cache[n]=fib(n-1)+fib(n-2)
return cache[n]
. /etc/lsb-release
if [ "$DISTRIB_ID" = "Arch" ]; then
DISTRIB_ID="Debian"
fi
echo $DISTRIB_ID IS WORST DISTRO