Skip to content

Instantly share code, notes, and snippets.

View antoninkriz's full-sized avatar
🌚

Antonín Kříž antoninkriz

🌚
View GitHub Profile
@antoninkriz
antoninkriz / CSharpBenchmarkByteToHex.cs
Last active February 11, 2024 08:38
C# - Performance analysis of converting byte[] to hexadecimal string
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
namespace Benchmark;
public class Bench
@antoninkriz
antoninkriz / print_gnome_keyring.py
Created October 14, 2021 13:18
Prints all saved secrets in Gnome Keyring using Python 2
#!/usr/bin/env python
import gnomekeyring as gk
for keyring in gk.list_keyring_names_sync():
print('=== KEYRING ' + keyring + ' ===')
for keyItem in gk.list_item_ids_sync(keyring):
try:
key = gk.item_get_info_sync(keyring, keyItem)
except:
@antoninkriz
antoninkriz / hashPassword.js
Last active January 19, 2021 23:39
Hashing strings in JS using the built-in SubtleCrypto library
const stringToUTF8Array = str => {
const utf8 = [];
for (let i = 0; i < str.length; i++) {
let charCode = str.charCodeAt(i);
if (charCode < 0x80) utf8.push(charCode);
else if (charCode < 0x800) {
utf8.push(0xc0 | (charCode >> 6),
0x80 | (charCode & 0x3f));
} else if (charCode < 0xd800 || charCode >= 0xe000) {
utf8.push(0xe0 | (charCode >> 12),
@antoninkriz
antoninkriz / fastRequests.cs
Last active January 8, 2023 23:58
C# code to quickly send requests to a HTTP server. Can send over ~1500 requests per second to a remote server.
using System.Net;
using System.Net.Http.Headers;
using System.Text;
namespace fastRequests
{
internal static class Program
{
private const string Host = "example.com";
private const string Url = "https://example.com/";
@antoninkriz
antoninkriz / folding_amd.md
Last active April 20, 2020 11:52
Tutorial on how to run Folding@Home client on a PC with AMD GPU

How to run Folding@Home on Linux on AMD GPU (Ubuntu 18.04)

What is this

Tutorial on how to run Folding@Home client on a PC with AMD graphics card and how to potenitally solve following errors:

  • BAD_WORK_UNIT (114 = 0x72)
  • Failed to start core: OpenCL device matching slot 1 not found, try setting 'opencl-index' manually
  • Error initializing context: clGetPlatformIDs (-1001)
  • OpenCL: Not detected: clGetDeviceIDs() returned -1
  • Received short response, expected 512 bytes, got 0

The tutorial

Keybase proof

I hereby claim:

  • I am antoninkriz on github.
  • I am antoninkriz (https://keybase.io/antoninkriz) on keybase.
  • I have a public key ASAbTsuxQyZ1xfdGRiKP5J4U5yxofvK-1l_WhVYjI9ndNgo

To claim this, I am signing this object:

@antoninkriz
antoninkriz / GitMergeReposInSubfolders.cs
Created April 24, 2018 18:21
Generates shell script that merges multiple GIT repositories into subfolders into a new repository
/**
* Generates shell script that merges multiple GIT repositories into subfolders into a new repository
* This script will output only a shell script which will automatically do all this booring git magic for you
* This code is not mean to be effective as-a-code in any way
* This code is under WTFPL Licence: http://www.wtfpl.net/
* Tested on .Net Core 2.1.0 preview
*
*
* **EXAMPLE**
* You have <repos> A, B, C. You want to create a <new repo> X which will contain <repos> in subfolders: