Skip to content

Instantly share code, notes, and snippets.

View RaphaelWimmer's full-sized avatar

Raphael Wimmer RaphaelWimmer

View GitHub Profile
@OrionReed
OrionReed / dom3d.js
Last active May 5, 2024 05:42
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@matthen
matthen / hello_world.py
Last active April 26, 2024 12:17
Hello world in python, using genetic algorithm
"""Hello world, with a genetic algorithm.
https://twitter.com/matthen2/status/1769368467067621791
"""
import random
import time
from dataclasses import dataclass
from itertools import chain
from typing import Iterable, List
@GrantTrebbin
GrantTrebbin / stl-surface.py
Created October 2, 2019 09:15
Generate a 3D model based on a 2D equation
# stl-surface.py
# Generate a 3D model based on a 2D equation
# The model will be rectangular with a flat base. The top surface is based on
# a provided equation in "surface_function". The file name can be set with the
# output_filename variable. The x and y width of the model and the grid spacing
# is defined by the following parameters.
# x_spacing
@Toliak
Toliak / shame.py
Last active February 14, 2023 10:16
Python runtime bytecode patch example
import functools
import struct
import types
import dis
def _patch_code(code: types.CodeType):
# Call function with 0 arguments
function_call_bytearray = bytearray(dis.opmap['CALL_FUNCTION'].to_bytes(1, byteorder='little') + b'\x00')
#!/usr/bin/env python
import math
import sys
from moviepy.editor import AudioClip, VideoFileClip, concatenate_videoclips
# Get average RGB of part of a frame. Frame is H * W * 3 (rgb)
# Assumes x1 < x2, y1 < y2

How to make a small tweak to free software

The target audience for this is people who are beginners at software engineering and using linux. A lot of the information here may be obvious or already known to you. The language involved is C but you do not need to know any C to read this tutorial. I used mg to write this blog post. I used vs code to edit the source code.

This post is also available on gopher://tilde.team:70/0/~river/tweak-free-software

If you use a piece of free software and it's 99% perfect but there's just this one thing it does that annoys the hell out of you.. you can in theory just fix it! Here's a look at what doing that is like. Hopefully it inspires you, or you pick up a could tricks on the way!

Step 0: Have a problem

@dajiaji
dajiaji / python_cwt_sample_eudcc_02.py
Last active November 17, 2021 11:50
A simple EUDCC verifier implementation with Python CWT.
import json
import os
import zlib
import requests
from base45 import b45decode
import cwt
from cwt import load_pem_hcert_dsc
@chopfitzroy
chopfitzroy / client.sh
Created August 4, 2016 06:26
Synergy multiple servers for one client
#!/bin/bash
# IP address to cycle through (in order of priority)
ip=( "192.168.20.102" "192.168.20.103" )
# Check if synergy is already connected
if pgrep "synergyc"; then
# Synergy already connected
echo "Synergy is already running."
else
@bhive01
bhive01 / see3cam_good_np_slicing.py
Created April 16, 2018 02:49
CU40 with Numpy Slicing (efficient for video on Raspberry Pi)
# TESTING HARDWARE
# see3CAM_CU40
# raspberry Pi 3 bf8
# Raspbian Stretch 13-03-2018
# Python 3.5.3
# OpenCV 3.4.1
# load required libraries
import math
import numpy as np
@pklaus
pklaus / arbitrary-waveform-test.py
Created May 4, 2012 19:05
Controlling the Rigol DG1022 with Python on Linux (using the usbtmc driver) – Proof of Concept
#!/usr/bin/env python2
import usbtmc
import time
from math import sin
listOfDevices = usbtmc.getDeviceList()
dn = listOfDevices[0]
d = usbtmc.UsbTmcDriver(dn)
print d.getName()