Skip to content

Instantly share code, notes, and snippets.

View turbolent's full-sized avatar

Bastian Müller turbolent

View GitHub Profile
@peterargue
peterargue / find_events.sh
Created July 5, 2022 18:29
Search for events from start height to latest using flow-cli
#!/bin/bash
EVENT=flow.AccountContractAdded
START=32795233
END=$(flow blocks get latest -n mainnet -o json | jq '.height')
echo "Start: ${START}"
echo "End: ${END}"
echo "Event: ${EVENT}"
for (( i=${START}; i<=${END}; i += 251 )); do
@brettcannon
brettcannon / config.site
Last active February 2, 2022 22:49
WASI-SDK w/ CPython
cross_compiling=yes
ac_cv_file__dev_ptmx=no
ac_cv_file__dev_ptc=no
@cellularmitosis
cellularmitosis / README.md
Last active April 12, 2024 16:35
QEMU PowerPC G4 OS X Tiger (10.4) setup
@dabeaz
dabeaz / README.txt
Created October 15, 2019 20:10
PyCon India 2019, Code from Keynote Presentation by @dabeaz
Code from PyCon India 2019 Keynote Talk
David Beazley (https://www.dabeaz.com)
======================================
This code is presented "as is" and represents what was live-coded
during my closing keynote presentation at PyCon India, Chennai,
October 13, 2009. I have made no changes to the files.
Requires: Python 3.6+, numpy, pygame
@binji
binji / main-sdl.c
Created January 8, 2019 16:54
FunkyKarts wasm2c main
#include <assert.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define GL_GLEXT_PROTOTYPES
@yurydelendik
yurydelendik / get_dwarf_info.py
Last active March 20, 2022 17:54
Extarct DWARF-like information from binary WASM
#!/usr/bin/env python
"""Utility to extract .debug_info section and print that in JSON format.
"""
import argparse
from collections import OrderedDict
import json
import logging
from math import ceil, log
import os
@shafik
shafik / WhatIsStrictAliasingAndWhyDoWeCare.md
Last active May 2, 2024 15:08
What is Strict Aliasing and Why do we Care?

What is the Strict Aliasing Rule and Why do we care?

(OR Type Punning, Undefined Behavior and Alignment, Oh My!)

What is strict aliasing? First we will describe what is aliasing and then we can learn what being strict about it means.

In C and C++ aliasing has to do with what expression types we are allowed to access stored values through. In both C and C++ the standard specifies which expression types are allowed to alias which types. The compiler and optimizer are allowed to assume we follow the aliasing rules strictly, hence the term strict aliasing rule. If we attempt to access a value using a type not allowed it is classified as undefined behavior(UB). Once we have undefined behavior all bets are off, the results of our program are no longer reliable.

Unfortunately with strict aliasing violations, we will often obtain the results we expect, leaving the possibility the a future version of a compiler with a new optimization will break code we th

@eevee
eevee / pico8jstocart.py
Created March 23, 2017 12:14
Python script to convert exported JavaScript back into a PICO-8 cartridge
import os.path
import re
import sys
# LZ-ish decompression scheme borrowed from picolove:
# https://github.com/gamax92/picolove/blob/master/cart.lua
compression_map = b"\n 0123456789abcdefghijklmnopqrstuvwxyz!#%(){}[]<>+=/*:;.,~_"
def decompress(code):
lua = bytearray()

Getting Started in Scala

This is my attempt to give Scala newcomers a quick-and-easy rundown to the prerequisite steps they need to a) try Scala, and b) get a standard project up and running on their machine. I'm not going to talk about the language at all; there are plenty of better resources a google search away. This is just focused on the prerequisite tooling and machine setup. I will not be assuming you have any background in JVM languages. So if you're coming from Python, Ruby, JavaScript, Haskell, or anywhere…  I hope to present the information you need without assuming anything.

Disclaimer It has been over a decade since I was new to Scala, and when I was new to Scala, I was coming from a Java and Ruby background. This has probably caused me to unknowingly make some assumptions. Please feel free to call me out in comments/tweets!

One assumption I'm knowingly making is that you're on a Unix-like platform. Sorry, Windows users.

Getting the JVM

@ssp
ssp / clone-and-build-gitx.sh
Last active November 1, 2016 15:00
Script to clone and build gitx
#!/usr/bin/env sh
#
# Script to clone gitx from github and build it using
# the scripts provided by the project.
#
# Sven-S. Porst @ssp <ssp-web@earthlingsoft.net>
#
git clone https://github.com/ssp/gitx.git
cd gitx