Skip to content

Instantly share code, notes, and snippets.

@julbouln
julbouln / ryzen4_ctl.rb
Created January 9, 2024 15:51
Ryzen 7900X PBO settings control using ryzen_smu
#!/usr/bin/ruby
require 'optparse'
class SMU
# from zenstates
SMU_MSG_TransferTableToDram = 0x3
SMU_MSG_GetDramBaseAddress = 0x4
SMU_MSG_GetTableVersion = 0x5
SMU_MSG_EnableOcMode = 0x5D
@julbouln
julbouln / csv_fixer.csv
Created January 27, 2023 09:13
Malformed CSV fixer
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
class CSVFixer
attr_accessor :rows
def initialize(filename)
@rows = []
input_csv = CSV.open(filename)
loop do
begin
row = input_csv.shift
break unless row
@julbouln
julbouln / passsani.rb
Created July 17, 2021 20:42
extraction des données du passe sanitaire incluses dans le QR-code UE
require 'uri'
require 'base64'
require 'cgi'
require 'zlib'
require 'pp'
require 'cbor'
# https://github.com/svnee/base54
module Base45
@julbouln
julbouln / c_refactoring_tool.rb
Created April 7, 2021 14:52
convert C globals to structures using clang ast json dump
require 'set'
require 'json'
require 'tree'
require 'fileutils'
# convert C globals to structures using clang ast json dump
# algorithm description
# - get AST with clang
# - convert AST into ruby tree
%code requires {
/*
* Copyright (C) 2002-2003 Lars Knoll (knoll@kde.org)
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
* Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
* Copyright (C) 2008 Eric Seidel <eric@webkit.org>
* Copyright (C) 2012 Intel Corporation. All rights reserved.
*
* This library is free software; you can redistribute it and/or
@julbouln
julbouln / am57xx-beagle-x15.dts
Created May 25, 2018 21:29
dts portable beagleboard x15
/*
* Copyright (C) 2014-2016 Texas Instruments Incorporated - http://www.ti.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include "am57xx-beagle-x15-common.dtsi"
#include "am57xx-cmem.dtsi"
@julbouln
julbouln / gist:6a392e60c47ee2aec45d
Last active August 29, 2015 14:16
Simple ruby midi file player
require 'pp'
require "unimidi"
require 'midilib/sequence'
# Prompts the user to select a midi output
# Sends some arpeggiated chords to the output
output = UniMIDI::Output.gets
begin
# Create a new, empty sequence.
@julbouln
julbouln / java2cpp.rb
Created February 16, 2015 07:55
java to cpp
require 'pp'
require 'java'
require '/usr/share/java/javaparser.jar'
module Java2cpp
class JavaFile
attr_accessor :class_dependencies, :class_defined
include_package "japa.parser"
java_import "java.io.FileInputStream"