Skip to content

Instantly share code, notes, and snippets.

View rkujawa's full-sized avatar

Radosław Kujawa rkujawa

View GitHub Profile
#include <Wire.h>
void setup()
{
Wire.begin();
Wire.beginTransmission(0x60); // transmit to device
Wire.send(0x40); // byte 1
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015
The NetBSD Foundation, Inc. All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.
NetBSD 7.0_STABLE (GENERIC.201604041900Z)
total memory = 3949 MB
avail memory = 3817 MB
kern.module.path=/stand/amd64/7.0/modules
@rkujawa
rkujawa / fooapp.c
Created August 29, 2017 21:42
fooapp - C source
#include <stdio.h>
#include <unistd.h>
int
main(int argc, char *argv)
{
printf("let's try to run execve!\n");
execve("/bin/sh", 0, 0);
@rkujawa
rkujawa / fooapp.te
Created August 29, 2017 21:42
fooapp - SELinux policy
policy_module(fooapp, 1.0.19)
require {
type unconfined_t;
role unconfined_r;
class process { transition siginh noatsecure rlimitinh };
}
attribute_role fooapp_roles;
roleattribute system_r fooapp_roles;
cpu video_cyc= 0 0@ 0 : $00fc0008 : 46f8 2700 move $2700.w,sr
cpu video_cyc= 20 20@ 0 : $00fc000c : 3e7c 1000 movea.w #$1000,sp
cpu video_cyc= 28 28@ 0 : $00fc0010 : 4eb9 00fc 001c jsr $fc001c
cpu video_cyc= 48 48@ 0 : $00fc001c : 7002 moveq #2,d0
cpu video_cyc= 52 52@ 0 : $00fc001e : 23c0 0000 1000 move.l d0,$1000
cpu video_cyc= 72 72@ 0 : $00fc0024 : 4e75 rts
cpu video_cyc= 88 88@ 0 : $00fc0016 : 4e71 nop
cpu video_cyc= 92 92@ 0 : $00fc0018 : 60fc bra.s $fc0016
cpu video_cyc= 104 104@ 0 : $00fc0016 : 4e71 nop
cpu video_cyc= 108 108@ 0 : $00fc0018 : 60fc bra.s $fc0016
@rkujawa
rkujawa / compiling.sh
Created May 1, 2017 21:59
Compiling GPU accelerated things on Fedora 26
# using plain CUDA (requires cuda-devel)
nvcc --compiler-options "-std=c++98" -I /usr/include/cuda/ -o executable source.cu
# using OpenACC with NVPTX (requires gcc-offload-nvptx and cuda-devel)
gcc source.c -fopenacc -foffload=nvptx-none -foffload="-O3" -O3 -o executable
# using OpenCL with CUDA backend (requires cuda-devel, opencl-headers, ocl-icd, ocl-icd-devel)
gcc -Wall -W -O3 -I /usr/include/cuda -o executable source.cpp -L/usr/lib64 -Wl,-R,/usr/lib64 -lOpenCL
@rkujawa
rkujawa / HL-L2360DW.md
Created March 9, 2017 20:12
Using Brother HL-L2360DW on NetBSD
$ cat /etc/printcap | grep '^[^#]'
ps|Brother:\
        :lp=:lf=/var/log/lpd-errs:mx#0:sh:\
        :sd=/var/spool/output/lpd/ps:\
        :rm=BRWxxxxxxxxxxxx.local:\
        :rp=pcl_p1:\
        :if=/opt/printing/filter-ps2pcl.sh:
$ cat /opt/printing/filter-ps2pcl.sh
#!/bin/sh
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/file.h>
static const char *filename = "/tmp/lockme";
int
@rkujawa
rkujawa / ivecs.c
Created September 17, 2016 21:24
/*
* Preliminary driver for an Indivision ECS graphics core.
*
* The amiga bus_space(9) implementation does not have bus_space_poke/peek
* functions implemented. These would be useful, as there's no way to detect
* Indivision ECS without writing to bus space.
*
* TODO:
* - everything
* - man page

Keybase proof

I hereby claim:

  • I am rkujawa on github.
  • I am rkujawa (https://keybase.io/rkujawa) on keybase.
  • I have a public key whose fingerprint is B86D EF7A EC86 3837 E705 B978 3013 7C07 1B07 18AF

To claim this, I am signing this object: