Skip to content

Instantly share code, notes, and snippets.

View davidfischer-ch's full-sized avatar

David Fischer davidfischer-ch

View GitHub Profile

Frequency Testing

This will allow you to test a specific frequency that you hear when you do your resonance testing in Klipper and potentially track down where extra peaks are coming from. If something is rattling at a specific frequency, you can specify that frequency and feel around the printer until you track it down.

Code was adopted by zifnab from somewhere in Klipper.

Usage

You have to have [resonance_holder] in your printer.cfg.

The command is HOLD_RESONANCE AXIS=<axis> FREQ=int SECONDS=<seconds>

@davidfischer-ch
davidfischer-ch / sonar_sarif_to_generic.py
Last active January 12, 2024 10:53
sonar_sarif_to_generic.py
"""
Convert SARIF to Generic SonarQube issues import format.
Links:
* https://community.sonarsource.com/t/import-sarif-results-as-security-hotspots/83223
* docs.sonarqube.org/9.8/analyzing-source-code/importing-external-issues/generic-issue-import-format
* https://gist.github.com/davidfischer-ch/cdfede27ac053a8332b2127becc07608
Author: David Fischer <david@fisch3r.net>
@davidfischer-ch
davidfischer-ch / french.py
Created March 26, 2020 10:27
French Dictionary Statistics
#!/usr/bin/env python3
"""
We want to buy magnetic letters to teach French at home during the COVID-19 crisis.
I was wondering what is the optimal bag of letters to be able to *write* French words.
This script implements two ways of estimating this, *optimal bag of letters*:
- Per word max occurrence of each letters (ensure the bare minimum to write any single word of the dictionary [1])
- Statistical occurrence of letters (biased as words frequency is strongly dependent of the context [2])
#!/usr/bin/env python
"""
Convert camel-case to snake-case in python.
e.g.: CamelCase -> snake_case
e.g.: snake_case -> CamelCase
e.g.: CamelCase -> dash-case
e.g.: dash-case -> CamelCase
By: Jay Taylor [@jtaylor]
Me<modifier>: Yahya Kacem <fuj.tyoli@gmail.com>
Original gist: https://gist.github.com/jaytaylor/3660565
FIELDS = ['cmd', 'command', 'start', 'end', 'delta', 'msg', 'stdout', 'stderr']
def human_log(res):
if isinstance(res, dict):
for field in FIELDS:
if field in res.keys():
encoded_field = res[field].encode('utf-8')
print '\n{0}:\n{1}'.format(field, encoded_field)