Skip to content

Instantly share code, notes, and snippets.

View speters's full-sized avatar

Sönke J. Peters speters

View GitHub Profile
@w-e-w
w-e-w / sd-webui-txt2img-img2img-api-example.py
Last active November 14, 2024 15:22
Stable Diffusion web UI txt2img img2img api example script
from datetime import datetime
import urllib.request
import base64
import json
import time
import os
webui_server_url = 'http://127.0.0.1:7860'
out_dir = 'api_out'
@wd5gnr
wd5gnr / customprintf.c
Created October 3, 2023 16:32
Example of custom printf specifier
#include <stdio.h>
#include <stdlib.h>
#include <printf.h>
static int print_coin (FILE *stream,
const struct printf_info *info,
const void *const *args)
{
@four0four
four0four / 01-zynq-uart.md
Last active May 12, 2024 04:20
Zynq BootROM Secrets - UART loader

Zynq BootROM Secrets: UART loader

Recently I acquired (md5: ADF639AFE9855EE86C8FAAD216C970D9) the Zynq bootrom, and during the reversing process uncovered some interesting secrets, one of which is an as-of-yet undocumented UART loader. As documented the Zynq bootrom will load from NOR/NAND/SPI flashes, eMMC/SDIO-based storage (unfortunately) not USB, or anything else more complex.

Not sure why Xilinx didn't document this. In my brief testing it is super unreliable if you just spit everything at once - they reset the RX/TX paths during the process, so timing is critical, but that might be the janky meter-long ftdi cable. You can change the baudrate during the process, but I was too lazy to do the math.

Here's the disassembly that made me look twice (that, and checks for the MIO boot_mode[2:0] that weren't specified in the docs :)):

ROM:0000A220 BL              uart_init
@arbakker
arbakker / README.md
Last active November 8, 2024 21:39
Manipulate GeoJSON/JSON with jq

Manipulate (Geo)JSON with jq

Remove attributes with jq from a GeoJSON file:

cat points.geojson | jq ".features[].properties |= del(.c) | .features[].properties |= del(.d)"

Add property with default value:

@mqu
mqu / rvitalk.rb
Last active December 30, 2018 10:14
rvitalk : ruby P300 protocol implementation to handle IO to Viessmann heating systems - outdated : please have a look at : https://github.com/mqu/viessmann-mqtt/
#!/usr/bin/ruby
# encoding: utf-8
# author : Marc Quinton, april 2015
# name : rvitalk : ruby P300 protocol implementation to handle IO to Viessmann heating systems
# object : connect to a Viessmann heating system via Optolink adaptator to query internal values.
# version : 0.5 - added write mode for commands, P300 constants,
# requirements : ruby >= 2.1, ruby-serialport, a serial USB optolink adapter, a Viessman heating system.
# licence : MIT
# links : http://openv.wikispaces.com/vcontrold ; https://gist.github.com/mqu
@mario52a
mario52a / FCInfo_en_Ver_1-29b-rmu_Docked.FCMacro
Last active September 15, 2024 16:30
Gives a series of informations about the selected shape and can display a conversion of length, inclination (degrees, radians, grades, pourcent) shape, surface, volume and the weight of the form in the density selected in different units of quantities international and Anglo-Saxon. (English version)
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""
***************************************************************************
* Copyright (c) <mario52> 2014 2015 2016 2017 2018 2019 2020 2021 2022 *
* 2023 2024 *
* This file is a supplement to the FreeCAD CAx development system. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License (LGPL) *
@shamil
shamil / mount_qcow2.md
Last active November 16, 2024 09:15
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
@sasa1977
sasa1977 / xmerl_demo.ex
Last active July 26, 2023 10:07
Simple xmerl usage demo in Elixir
defmodule XmlNode do
require Record
Record.defrecord :xmlAttribute, Record.extract(:xmlAttribute, from_lib: "xmerl/include/xmerl.hrl")
Record.defrecord :xmlText, Record.extract(:xmlText, from_lib: "xmerl/include/xmerl.hrl")
def from_string(xml_string, options \\ [quiet: true]) do
{doc, []} =
xml_string
|> :binary.bin_to_list
|> :xmerl_scan.string(options)
/*
step.c
Program to verify new algorithm for linear acceleration.
Author: Pramod Ranade <[email protected]>
*/
#include <stdio.h>
#include <io.h>
#include <stdlib.h>
@petedoyle
petedoyle / gist:4129668
Last active January 29, 2021 08:19
Notes: OpenWRT / Codel on TL-WDR4300

Overview

I'm tired of massive delay (500-1000 ms pings) while uploading large files. QoS helps some, but a significant portion remains due to bufferbloat (100-150ms). This leads to delay in VoIP calls and generally sluggish web browsing while uploading.

The new Codel algorithm in OpenWRT / Attitude Adjustment should help a lot. The results below show only ~5-6ms of added latency during uploads (i.e. 14ms vs 500+ms before!). Insane.

These instructions are for the TP-Link TL-WDR4300, because I got a good deal. If you have the money, buy a Netgear WNDR3800 and install CeroWRT, you'll probably see even better results.

Why the TP-Link TL-WDR4300

In short, its fully supported in OpenWRT Attitude Adjustment and works well for my needs:

  • Cheap