Skip to content

Instantly share code, notes, and snippets.

View sakamoto-poteko's full-sized avatar
Proletarier aller Länder, vereinigt euch!

坂本ポテコ sakamoto-poteko

Proletarier aller Länder, vereinigt euch!
  • Duna, Kerbol System
View GitHub Profile
@sakamoto-poteko
sakamoto-poteko / a20test.asm
Last active January 30, 2024 01:51
A20-test
[bits 16]
org 07c00h
mov ax, cs
mov ds, ax
mov es, ax
call check_a20
test ax, ax
@sakamoto-poteko
sakamoto-poteko / nvml.cpp
Last active October 21, 2022 23:11
NVML Get GPU Utilization
#include <cstdio>
#include <nvml.h>
#pragma comment(lib, "nvml")
int main(int argc, char* argv[])
{
nvmlReturn_t result;
unsigned int device_count;
@sakamoto-poteko
sakamoto-poteko / gen.sh
Created January 23, 2021 06:03
OpenSSL generate root and intermediate CA (simple)
#!/bin/bash
# Root CA
echo 'Generating Root CA'
openssl ecparam -name secp384r1 -genkey -noout -out ca.key.pem
openssl req -x509 -new -nodes -key ca.key.pem -sha512 -days 3650 -out ca.crt.pem
openssl pkcs12 -inkey ca.key.pem -in ca.crt.pem -export -out ca.pfx
# Intermediate CA
echo 'Generating Intermediate CA'
@sakamoto-poteko
sakamoto-poteko / openssl-verify-rsa-signature.c
Last active November 18, 2020 15:37
OpenSSL verify RSA signature, read RSA public key from X509 PEM certificate
#include <stdio.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>
void verifyRSASignature(unsigned char *originalMessage, unsigned int om_length,
unsigned char *signature, unsigned siglen)
{
int result;
FILE *file;
@sakamoto-poteko
sakamoto-poteko / bin2hex.zsh
Created November 3, 2020 13:17
bin text to hex
file=`cat cipher.txt | sed -e 's/[\r\n]/ /g'`
for word in ${=file}
do
printf '%02x ' $((0b$word))
done
@sakamoto-poteko
sakamoto-poteko / pose_est.cpp
Last active January 9, 2020 06:24
Pose estimation from accelerometer and gyroscope
// libshovel.cpp : Defines the entry point for the application.
//
//
#include "Eigen/Eigen"
namespace shovel {
struct Pose
{
@sakamoto-poteko
sakamoto-poteko / HPS.m
Last active December 4, 2019 04:19
HPS algorithm for tone detection
function [ freq ] = HPS(audiofile)
CORRECTFACTOR=1;
[sample, fs] = audioread(audiofile);
fftn = fs;
sample = sample .* hann(length(sample));
fftr = abs(fft(sample,fftn));
fftr = fftr(1:fftn/2);
@sakamoto-poteko
sakamoto-poteko / gnutls-verify-chain.c
Created December 22, 2014 02:51
Verify certificate chain against given CA (PEM) using GnuTLS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
int main(void)
{
FILE *fl;
@sakamoto-poteko
sakamoto-poteko / Makefile
Created April 18, 2018 07:38
.Net Interop Example
all:
g++ -shared interop.cpp -o libmain.so
set vpn ipsec ipsec-interfaces interface pppoe0
set vpn ipsec auto-firewall-nat-exclude enable
set vpn ipsec nat-traversal enable
set vpn ipsec esp-group esp-azure compression disable
set vpn ipsec esp-group esp-azure lifetime 3600
set vpn ipsec esp-group esp-azure mode tunnel
set vpn ipsec esp-group esp-azure pfs disable
set vpn ipsec esp-group esp-azure proposal 1 encryption aes256
set vpn ipsec esp-group esp-azure proposal 1 hash sha1