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);
@jhasse
jhasse / main.cpp
Created May 25, 2011 10:18
SHA-1 With Boost
#include <iostream>
#include <boost/uuid/sha1.hpp>
void display(char* hash)
{
std::cout << "SHA1: " << std::hex;
for(int i = 0; i < 20; ++i)
{
std::cout << ((hash[i] & 0x000000F0) >> 4)
<< (hash[i] & 0x0000000F);
@jhasse
jhasse / main.cpp
Created May 27, 2012 14:53
Coroutine implementation in C++11
#include <iostream>
#include <thread>
class InterruptedException : public std::exception {
};
class AsyncThread {
public:
AsyncThread() {
std::unique_lock<std::mutex> lock(mutex);
#!/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
+
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
# 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": {