Skip to content

Instantly share code, notes, and snippets.

Python Cheatsheet stuff

Google Docstring

OpenGL ES 2.0 Renderer: GeForce GTX 1660 Ti/PCIe/SSE2
OpenGL ES 2.0 Batching: ON
Incoming Crash/Memory corruption
=================================================================
==137968==ERROR: AddressSanitizer: heap-use-after-free on address 0x6070005674f0 at pc 0x00000146b617 bp 0x7ffd288f9b70 sp 0x7ffd288f9b60
WRITE of size 8 at 0x6070005674f0 thread T0
#0 0x146b616 in Ref<Reference>::unref() core/reference.h:281
#1 0x7072551 in RefPtr::unref() core/ref_ptr.cpp:90
#2 0x7126bc7 in Variant::clear() core/variant.cpp:1129
@Paspartout
Paspartout / rgb565.c
Created September 12, 2019 13:44
rgb888 -> rgb565 conversion
#include <stdio.h>
#include <stdint.h>
static uint16_t
rgb888_to_rgb565(uint32_t rgb888) {
const uint8_t red = (rgb888 & 0xFF0000) >> 16;
const uint8_t green = (rgb888 & 0x00FF00) >> 8;
const uint8_t blue = (rgb888 & 0x0000FF);
rgb888 = ((red & 0xF8) << 8) | ((green & 0xFC) << 3) | ((blue & 0xF8) >> 3);
return (uint16_t)rgb888;
CC build/odroid/odroid_display.o
/home/paspartout/dev/lab/odroid/super-go-play/nesemu-go/components/odroid/odroid_display.c: In function 'spi_task':
/home/paspartout/dev/lab/odroid/super-go-play/nesemu-go/components/odroid/odroid_display.c:186:33: warning: passing argument 1 of 'line_buffer_put' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
line_buffer_put(t->tx_buffer);
^
/home/paspartout/dev/lab/odroid/super-go-play/nesemu-go/components/odroid/odroid_display.c:160:20: note: expected 'uint16_t * {aka short unsigned int *}' but argument is of type 'const void *'
static inline void line_buffer_put(uint16_t* buffer)
^
/home/paspartout/dev/lab/odroid/super-go-play/nesemu-go/components/odroid/odroid_display.c:172:15: warning: unused variable 'param' [-Wunused-variable]
uint16_t* param;
@Paspartout
Paspartout / daten.tsv
Last active May 8, 2018 13:52
Rect Accel Gyro Readout
a/g: 256 -16 15048 -187 -164 366
a/g: 480 128 14948 -184 -142 343
a/g: 532 -156 14836 -157 -99 360
a/g: 600 -8 14944 -152 -143 422
a/g: -20 -628 14728 -166 -137 471
a/g: 188 20 14996 -178 -144 484
a/g: 692 -32 14952 -147 -116 520
a/g: 300 -320 15016 -173 -149 589
a/g: 424 -432 14748 -159 -143 764
a/g: -540 -172 15744 -191 -144 831
@Paspartout
Paspartout / daten.csv
Created May 8, 2018 13:52
Rect Accel Gyro Readout
a/g: 480 128 14948 -184 -142 343
a/g: 532 -156 14836 -157 -99 360
a/g: 600 -8 14944 -152 -143 422
a/g: -20 -628 14728 -166 -137 471
a/g: 188 20 14996 -178 -144 484
a/g: 692 -32 14952 -147 -116 520
a/g: 300 -320 15016 -173 -149 589
a/g: 424 -432 14748 -159 -143 764
a/g: -540 -172 15744 -191 -144 831
// This program calculates pi sequentially in the function baseline,
// and in parallel in the function parallel.
// Compile with `gcc -fopenmp numerical_integ.c`
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
// DEBUG is a flag that determines if debug output is print.
// Compile with -DDEBUG to enable.
@Paspartout
Paspartout / nmesh-setup
Created October 4, 2016 09:39
80211s mesh setup
#!/bin/sh
# meshid is like an ssid
meshid=nicer
# this interface as if every node is directly connected to it(switch)
meshinterface=mesh0
ipaddress=192.168.1.1/24
die() {
echo "$@" >&2
@Paspartout
Paspartout / mesh-setup
Last active October 1, 2020 07:13
babel mesh setup
#!/bin/sh
# This script will automatically join a mesh network.
# Modified script from:
# https://www.irif.univ-paris-diderot.fr/~jch/software/files/wifi-autoconf.sh
essid="nicer"
channel=1
ipaddress=192.168.1.1
@Paspartout
Paspartout / gist:c52ce511377ba3cb56a1
Last active August 29, 2015 14:20 — forked from qbit/gist:5483415
ksh git prompt
# ksh git prompt support
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Distributed under the GNU General Public License, version 2.0.
#
# This script allows you to see the current branch in your prompt.
#
# To enable:
#
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).