Skip to content

Instantly share code, notes, and snippets.

View flozz's full-sized avatar

Fabien LOISON flozz

View GitHub Profile
@flozz
flozz / obsidian-file-checker-php.php
Created January 20, 2017 09:59
Checks that an Obsidian File is coherent (based on header and file size)
<?php
function check_obsidian_project($bytes) {
$HEADERS_LENGTH = 51;
$MIN_SECTION_SIZE = 2;
if (strlen($bytes) <= $HEADERS_LENGTH) {
return false;
}
@flozz
flozz / font-convertor.py
Created May 12, 2017 07:28
Converts fonts using FontForge
#!/usr/bin/env python
## To allow this script to work, you must install FontForge with its Python
## extention. On Debian / Ubuntu, this can be done with the following command:
##
## apt install fontforge python-fontforge
## usage: font-convertor.py [-h] input_file output_file
##
## Converts fonts using FontForge
@flozz
flozz / desable_touchpad.py
Last active August 24, 2017 12:18
Disables the touchpad of the Thinkpad X1 Carbon under X11. It probably wroks with other PC too.
#!/usr/bin/env python
## DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
## Version 2, December 2004
##
## Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
##
## Everyone is permitted to copy and distribute verbatim or modified
## copies of this license document, and changing it is allowed as long
## as the name is changed.
@flozz
flozz / gitea_macaron_log.txt
Created December 6, 2017 09:52
Gitea Macaron log
[Macaron] 2017-12-06 10:41:22: Started GET /test/test-lfs.git/info/refs?service=git-receive-pack for 127.0.0.1
[Macaron] 2017-12-06 10:41:22: Completed GET /test/test-lfs.git/info/refs?service=git-receive-pack 401 Unauthorized in 1.08318ms
[Macaron] 2017-12-06 10:41:26: Started GET /test/test-lfs.git/info/refs?service=git-receive-pack for 127.0.0.1
[Macaron] 2017-12-06 10:41:26: Completed GET /test/test-lfs.git/info/refs?service=git-receive-pack 401 Unauthorized in 2.185333ms
[Macaron] 2017-12-06 10:41:26: Started GET /test/test-lfs.git/info/refs?service=git-receive-pack for 127.0.0.1
[Macaron] 2017-12-06 10:41:26: Completed GET /test/test-lfs.git/info/refs?service=git-receive-pack 200 OK in 56.129674ms
[Macaron] 2017-12-06 10:41:30: Started POST /test/test-lfs.git/info/lfs/locks/verify for 127.0.0.1
[Macaron] 2017-12-06 10:41:30: Completed POST /test/test-lfs.git/info/lfs/locks/verify 200 OK in 35.306103ms
[Macaron] 2017-12-06 10:41:30: Started GET /test/test-lfs.git/info/refs?service=git-upload-pack for 127
@flozz
flozz / foobar.js
Created April 5, 2018 08:47
JSDoc examples for shpinx-js
/**
*/
class Foobar {
/**
* If we let jsdoc extracting the default values (es6 syntax), the
* result is ok for simple types (number, string, boolean and null)
*
* @param {*} a
* @param {number} [b]
@flozz
flozz / gnome_shell_wayland_meta_window_hack.py
Created May 14, 2018 18:06
A small hack that allows to manipulate windows on GNOME Shell / Wayland
#!/usr/bin/env python
import json
import pydbus
GNOME_SHELL = "org.gnome.Shell"
META_WINDOW_JS = """
(function(params) {
@flozz
flozz / Makefile
Last active January 8, 2022 17:26
Builds a frozen version of WeasyPrint that includes all required dependencies and libraries.
# Builds a frozen version of WeasyPrint (https://github.com/kozea/weasyprint)
# that includes all required dependencies and libraries.
#
# Dependencies:
#
# * GNU make (build-essential package on Debian)
# * Python headers (python3-dev package on Dabian)
# * virtualenv
#
# Usage:
@flozz
flozz / bgb_debug.h
Last active November 18, 2020 01:09
GameBoy BGB Debug Macros (SDCC)
// BGB Debug -- Help debugging GameBoy programs in BGB
// Copyright (c) 2019 Fabien LOISON <https://flozz.fr/>
// ==== LICENSE ==============================================================
// DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
// Version 2, December 2004
//
// Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
//
#!/usr/bin/env python
## DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
## Version 2, December 2004
##
## Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
##
## Everyone is permitted to copy and distribute verbatim or modified
## copies of this license document, and changing it is allowed as long
## as the name is changed.
@flozz
flozz / arctis7.py
Last active August 3, 2023 13:40
Displays the battery level of a SteelSeries Acrtis 7 headset.
#!/usr/bin/env python3
"""
This script displays the battery level of a SteelSeries Acrtis 7 headset.
USING
-----
To use this script you must install hidapi (https://github.com/trezor/cython-hidapi):