Skip to content

Instantly share code, notes, and snippets.

View atomgomba's full-sized avatar

Károly Kiripolszky atomgomba

View GitHub Profile
@atomgomba
atomgomba / buildflags.py
Last active February 1, 2024 19:41
Generate C code for Betaflight build flags
import requests
JSON_URL = "https://build.betaflight.com/api/options/4.5.0-zulu"
def get_gates_options() -> tuple:
data = requests.get(JSON_URL, timeout=2).json()
gates = []
options = []
@atomgomba
atomgomba / c_cpp_properties.json
Created September 24, 2022 19:40
VSCode config for QMK development on Linux (Keychron K6 RGB)
{
"configurations": [
{
"name": "Linux",
"includePath": [
"/usr/lib/gcc/avr/5.4.0/include/**",
"/usr/lib/gcc/avr/5.4.0/include-fixed/**",
"/usr/lib/gcc/arm-none-eabi/10.3.1/include/**",
"/usr/lib/gcc/arm-none-eabi/10.3.1/include-fixed/**",
"/usr/lib/avr/include/**",
@atomgomba
atomgomba / Polymaker PolyFlex 95A.ini
Last active November 29, 2023 09:42
Filament settings for Polymaker PolyFlex 95A (Prusa Slic3r)
# generated by PrusaSlicer 2.3.0+linux-x64 on 2021-01-29 at 10:18:59 UTC
bed_temperature = 50
bridge_fan_speed = 100
compatible_printers =
compatible_printers_condition = nozzle_diameter[0]>0.35 and printer_model!="MK2SMM" and printer_model!="MINI" and num_extruders==1 && ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK3.*/ and single_extruder_multi_material)
compatible_prints =
compatible_prints_condition =
cooling = 1
disable_fan_first_layers = 5
end_filament_gcode = "; Filament-specific end gcode"
@atomgomba
atomgomba / 0.2mm - Polymaker PolyFlex 95A.ini
Created January 29, 2021 10:23
Print settings for Polymaker PolyFlex 95A (Prusa Slic3r)
# generated by PrusaSlicer 2.3.0+linux-x64 on 2021-01-29 at 06:27:08 UTC
avoid_crossing_perimeters = 1
avoid_crossing_perimeters_max_detour = 0
bottom_fill_pattern = monotonic
bottom_solid_layers = 5
bottom_solid_min_thickness = 0.5
bridge_acceleration = 1000
bridge_angle = 0
bridge_flow_ratio = 1
bridge_speed = 35
@atomgomba
atomgomba / terminate.gcode
Created November 14, 2019 13:55
Finish/cancel GCode snippet for 3D printers
M104 S0; Set Hot-end to 0C (off)
M140 S0; Set bed to 0C (off)
G91; Relative positioning
G0 Z50; Move +50 units on Z
G1 Y180 F9000; Feed the bed forward making removal easy
M84; Disable motors
M106 S0; Disable fan
@atomgomba
atomgomba / randint.ino
Last active February 28, 2021 16:09
A way to generate a tiny bit more useful random numbers on Arduino
long rand(int min, int max) {
long result;
for (int i = 0; i < analogRead(A0); i++)
{
randomSeed(analogRead(A0));
result = random(min, max);
}
return result;
}
@atomgomba
atomgomba / TestLifecycleOwner.kt
Created March 4, 2019 13:26
Android LifecycleOwner for unit testing
import androidx.lifecycle.Lifecycle.State
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LifecycleRegistry
/**
* @author Károly Kiripolszky <karcsi@ekezet.com>
*/
class TestLifecycleOwner(state: State = State.STARTED) : LifecycleOwner {
private val lifecycle = LifecycleRegistry(this)
@atomgomba
atomgomba / TestCoroutineDispatcher.kt
Last active March 4, 2019 13:26
Kotlin coroutine dispatcher for unit testing
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Runnable
import kotlin.coroutines.CoroutineContext
/**
* @author Károly Kiripolszky <karcsi@ekezet.com>
*/
class TestCoroutineDispatcher : CoroutineDispatcher() {
override fun dispatch(context: CoroutineContext, block: Runnable) {
block.run()
@atomgomba
atomgomba / example.py
Last active September 13, 2019 14:12
Python logging argparse utility for controlling logging level
from . import logging
from .logging import log
def main(args):
# set up logging from the arguments
logging.init(args)
log.info("hello world!")
if __name__ == "__main__":
@atomgomba
atomgomba / findbymac.sh
Last active November 12, 2018 15:53
Find the IP of a Raspberry Pi (or any computer really) on the network by MAC
#!/bin/bash
#
# Find the IP address of a client by MAC on the same network. Sudo privilege and nmap required.
#
# usage: ./findbymac.sh <MAC_ADDRESS>
#
# The first argument to the script is the MAC address or part of the MAC address.
#
# example: sudo ./findbymac.sh "aa:b8"
#