Skip to content

Instantly share code, notes, and snippets.

Wladimir J. van der Laan laanwj

  • The Netherlands
View GitHub Profile
View sendalert.cpp
// *** CONFIDENTIAL - NOT FOR RELEASE ***
#include "main.h"
#include "net.h"
#include "alert.h"
#include "init.h"
static const int64_t DAYS = 24 * 60 * 60;
void ThreadSendAlert()
{
@laanwj
laanwj / c++14.patch
Created May 31, 2018
Patch for buiding Bitcoin Core with C++14
View c++14.patch
diff --git a/configure.ac b/configure.ac
index 1ffef1527bdb556dff79338f4052d1b49ae6bc42..5f324894bd861fe92ec7fad24b6687876b0e1919 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,8 +60,8 @@ case $host in
lt_cv_deplibs_check_method="pass_all"
;;
esac
-dnl Require C++11 compiler (no GNU extensions)
-AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory], [nodefault])
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>
You can’t perform that action at this time.