Skip to content

Instantly share code, notes, and snippets.

@Xekep
Xekep / dh.c
Created January 9, 2021 11:54 — forked from cloudwu/dh.c
Diffie-Hellman Key Exchange
// The biggest 64bit prime
#define P 0xffffffffffffffc5ull
#define G 5
#include <stdio.h>
#include <stdint.h>
#include <assert.h>
#include <stdlib.h>
// calc a * b % p , avoid 64bit overflow
@Xekep
Xekep / dh.c
Created January 9, 2021 11:54 — forked from cloudwu/dh.c
Diffie-Hellman Key Exchange
// The biggest 64bit prime
#define P 0xffffffffffffffc5ull
#define G 5
#include <stdio.h>
#include <stdint.h>
#include <assert.h>
#include <stdlib.h>
// calc a * b % p , avoid 64bit overflow
@Xekep
Xekep / probably_random.ino
Created August 21, 2020 07:46 — forked from endolith/LICENSE.txt
Arduino hardware true random number generator
#include <stdint.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>
byte sample = 0;
boolean sample_waiting = false;
byte current_bit = 0;
byte result = 0;
void setup() {
@Xekep
Xekep / cpuinfo.c
Created April 29, 2020 10:26 — forked from bellbind/cpuinfo.c
[c][intel][clang] get cpu info from CPUID intrinsic in clang/gcc
// intel CPUID opcode
// see: https://en.wikipedia.org/wiki/CPUID
// clang -Wall -Wextra -std=c11 cpuinfo.c -o cpuinfo
#include <stdint.h>
#include <stdio.h>
#include <cpuid.h> //macro __cpuid(eaxin, eaxout, ebx, ecx, edx)
int main() {
{
#pragma comment(lib, "advapi32.lib")
#include <windows.h>
#include <winnt.h>
#include <tlhelp32.h>
#include <tchar.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
@Xekep
Xekep / curlget.cpp
Created April 26, 2020 03:23 — forked from whoshuu/curlget.cpp
Example libcurl GET request
#include <curl/curl.h>
#include <string>
size_t writeFunction(void *ptr, size_t size, size_t nmemb, std::string* data) {
data->append((char*) ptr, size * nmemb);
return size * nmemb;
}
int main(int argc, char** argv) {
auto curl = curl_easy_init();
https://www.linux.org.ru/forum/admin/8644480
pico -w /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication no