Skip to content

Instantly share code, notes, and snippets.

@jhasse
jhasse / sha1.hpp
Created October 7, 2023 00:07
Standalone SHA1 implementation for C++
// Copyright 2007 Andy Tompkins
// Copyright 2023 Jan Niklas Hasse
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)
#pragma once
#include <iomanip>
#include <iostream>
#include <sstream>
@jhasse
jhasse / main.cpp
Last active October 6, 2023 23:54
Create SHA1 with Boost
#include <boost/uuid/detail/sha1.hpp>
#include <iomanip>
#include <iostream>
#include <sstream>
std::string sha1(const std::string& input) {
boost::uuids::detail::sha1 sha1;
sha1.process_bytes(input.data(), input.size());
unsigned int digest[5];
sha1.get_digest(digest);
#!/usr/bin/env python3
import json
import subprocess
import time
cputool = '/home/hasse/.local/share/gnome-shell/extensions/cpupower@mko-sl.de/src/cpufreqctl'
turbo_output = subprocess.check_output([cputool, 'turbo', 'get']).decode().strip()
if turbo_output != '0' and turbo_output != '1':
import sys
import subprocess
import os
import shutil
import re
old_dll = ""
def copy_dlls(binary):
print("\nChecking " + binary)
diff --git a/include/wx/string.h b/include/wx/string.h
index a4e682b8ff..ad0cc200a2 100644
--- a/include/wx/string.h
+++ b/include/wx/string.h
@@ -17,6 +17,8 @@
#ifndef _WX_WXSTRING_H__
#define _WX_WXSTRING_H__
+#define wxNO_UNSAFE_WXSTRING_CONV2 1
+
# pacman -Syu --needed --noconfirm --noprogressbar meson gcc sdl2 pkg-config fontconfig glew libwebp openal libvorbis boost
:: Synchronizing package databases...
core is up to date
extra is up to date
community is up to date
:: Starting full system upgrade...
resolving dependencies...
:: There are 2 providers available for libgl:
:: Repository extra
1) libglvnd 2) nvidia-340xx-utils
@jhasse
jhasse / tasks.json
Created September 12, 2017 08:13
Visual Studio Code task for cargo
{
"version": "2.0.0",
"windows": {
"command": "C:\\msys64\\usr\\bin\\bash"
},
"linux": {
"command": "/bin/bash"
},
"args": ["-lc", "cd \"\"${workspaceRoot}\"\" && cargo $0 && $@"],
"options": {
try:
import msvcrt
import atexit
import ctypes
from ctypes import wintypes
kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
# input flags
ENABLE_PROCESSED_INPUT = 0x0001
ENABLE_LINE_INPUT = 0x0002
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x00007fbb3a7d191c in ?? () from /usr/lib/x86_64-linux-gnu/dri/amdgpu_dri.so
#2 0x00007fbb3a7d1eb4 in ?? () from /usr/lib/x86_64-linux-gnu/dri/amdgpu_dri.so
#3 0x00007fbb3a7d4b56 in ?? () from /usr/lib/x86_64-linux-gnu/dri/amdgpu_dri.so
#4 0x00007fbb39c5ed98 in ?? () from /usr/lib/x86_64-linux-gnu/dri/amdgpu_dri.so
#5 0x00007fbb39c08f64 in ?? () from /usr/lib/x86_64-linux-gnu/dri/amdgpu_dri.so
#6 0x00007fbb39c09167 in ?? () from /usr/lib/x86_64-linux-gnu/dri/amdgpu_dri.so
#7 0x00007fbb3891f05f in ?? () from /usr/lib/x86_64-linux-gnu/dri/amdgpu_dri.so
#8 0x00007fbb398301b7 in ?? () from /usr/lib/x86_64-linux-gnu/dri/amdgpu_dri.so
~/git/rust-opengl-test (master) $ ulimit -c unlimited
~/git/rust-opengl-test (master) $ cargo run
Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs
Running `target/debug/rust-opengl-test`
Prefix path: /home/jhasse/git/rust-opengl-test
error: Process didn't exit successfully: `target/debug/rust-opengl-test` (signal: 11, SIGSEGV: invalid memory reference)
~/git/rust-opengl-test (master) $ ls /var/lib/systemd/coredump/
~/git/rust-opengl-test (master) $