Skip to content

Instantly share code, notes, and snippets.

Wladimir J. van der Laan laanwj

  • The Netherlands
Block or report user

Report or block laanwj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View moonphase.py
#!/usr/bin/python3
import datetime
import bisect
import ephem
DAY = 1.0/29.33
MOONPHASE = [
(0.0/4.0 + DAY, '🌑', 'New moon'),
(1.0/4.0 - DAY, '🌒', 'Waxing crescent moon'),
(1.0/4.0 + DAY, '🌓', 'First quarter moon'),
View 0001-etnaviv-NEON-implementations-of-tiling-untiling.patch
From b12050e430f6bf37334dd7b6995dd8c97d8aa68a Mon Sep 17 00:00:00 2001
From: "Wladimir J. van der Laan" <laanwj@gmail.com>
Date: Thu, 13 Jul 2017 15:43:09 +0000
Subject: [PATCH] etnaviv: NEON implementations of tiling/untiling
Experiemental NEON implementation of tiling/untiling that adds
specialized NEON function for tiling 8, 16, 32 bit per element
4x4 tiles. To optimize memory read/write sizes, there are functions that
process multiple horizontically adjactent tiles as well. These
are automatically used for the part that consists of whole tiles.
View notreallydict.py
#!/usr/bin/python3
import json
class notreallydict(dict):
def __init__(self, x):
dict.__init__(self, x)
self.x = x
def items(self):
return self.x
@laanwj
laanwj / fds.c
Created Nov 30, 2017
Check fd assignment
View fds.c
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
int main()
{
close(STDIN_FILENO);
int fd = open("/dev/null", O_RDWR);
@laanwj
laanwj / gcabi.c
Created Nov 15, 2017
Extract GCABI json
View gcabi.c
/**
arm-linux-gnueabihf-gcc -ggdb -g3 gcabi.c -o gcabi -I /.../galcore_headers/include_imx8_v6.2.3.129602
extract_structures_json.py gcabi _gcsHAL_INTERFACE _gcoCMDBUF _gcsQUEUE > data/gcs_hal_interface_GCABI.json
*/
#include <gc_abi.h>
struct _gcsHAL_INTERFACE x;
struct _gcoCMDBUF y;
struct _gcsQUEUE z;
@laanwj
laanwj / dumpcmdbufs.sh
Created Aug 25, 2017
a20x KGSL dump cmdbuf
View dumpcmdbufs.sh
#!/bin/bash
# enable command stream dumping, clear kernel ringbuffer,
# write output to a file provided on the command line
# this can be converted to .rd using dmesg2rd.py from
# https://github.com/laanwj/freedreno/blob/master/mlog/dmesg2rd.py
set -e
if [ "$(whoami)" != "root" ]; then
echo "This script needs to be executed as root"
exit 1
fi
@laanwj
laanwj / neontile.c
Created Jul 13, 2017
Vivante tiling experiments in NEON
View neontile.c
/* Vivante tiling experiments in NEON
W.J. van der Laan 2017, MIT license
*/
/* gcc neontile.c -o neontile -O2 -mfpu=neon */
#define _POSIX_C_SOURCE 200112L
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
@laanwj
laanwj / stats.py
Created Jun 15, 2017
Count statistics about connections for bitcoind RPC
View stats.py
#!/usr/local/bin/python3 [5/1819]
import sys
sys.path.append('./bitcoin/test/functional')
from test_framework.authproxy import AuthServiceProxy, JSONRPCException
import time
import os
datadir = os.path.join(os.getenv('HOME'), '.bitcoin')
with open(os.path.join(datadir,'.cookie'),'r') as f:
cookie = f.read()
@laanwj
laanwj / do_backport.py
Created Jun 5, 2017
Script to do backports (pull ids listed in to_backport.txt or command line) in order of merge, to minimize number of conflicts.
View do_backport.py
#!/usr/bin/env python3
'''
Script to do backports (pull ids listed in to_backport.txt or command line) in order of merge,
to minimize number of conflicts.
'''
import git
import re
import shlex
import subprocess
import os, sys
@laanwj
laanwj / decrypt.py
Last active Jun 6, 2019
Decrypt router configuration
View decrypt.py
#!/usr/bin/env python3
# W.J. van der Laan 2017, distributed under MIT license
import binascii
import base64
import json
import os, sys
from Crypto import Random
from Crypto.Cipher import AES
KEY = binascii.a2b_hex(b'fffffbffeffffbfffbbfffbfdbfff7ffffffffffffffdfffff7fffffbfffffff')
You can’t perform that action at this time.