Skip to content

Instantly share code, notes, and snippets.

View fador's full-sized avatar

Marko Viitanen fador

View GitHub Profile
@fador
fador / parseGeoTiff.cpp
Created June 17, 2024 09:55
Convert GeoTiff height map to 16-bit png
// Converts geotiff height map to 16-bit png
// g++ parseGeoTiff.cpp -lgdal -lpng -o parseGeoTiff
// use: ./parseGeoTiff input.tif output.png
// License: Simplified BSD License
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <gdal/gdal.h>
#include <gdal/gdal_priv.h>
@fador
fador / windows.sh
Last active October 11, 2022 10:51 — forked from fasterthanlime/windows.sh
Building ffmpeg & kvazaar with MSVC from msys2
#!/bin/bash
# put script to ~/Release/windows.sh
# run from ~: CI_ARCH=x86_64 ./Release/windows.sh
# Modified from https://gist.github.com/fasterthanlime/b674346115e88b762d76dac02fef6bd3
# to build Kvazaar with VS2022 support
set -e
if [[ -z "${FFRUST_VC_PATH}" ]]; then
@fador
fador / totp_paster_win32.cpp
Last active September 13, 2022 17:33
Paste TOTP directly to the console with a hotkey in windows
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctime>
#include <openssl/evp.h>
#include <openssl/hmac.h>
#include <string>
@fador
fador / kvazaar_uvgrtp.c
Created August 22, 2022 06:02
Example of using Kvazaar as a library together with uvgRTP
#define _CRT_SECURE_NO_WARNINGS
#include <uvgrtp/lib.hh>
#include <kvazaar.h>
#define VIDEO_FRAME_MAXLEN 1024*1024
#define INPUT_YUV_FILE "~/WORK/sequences/BQMall_832x480_60.yuv"
#define INPUT_WIDTH 832
#define INPUT_HEIGHT 480
@fador
fador / chat.js
Created December 14, 2019 20:14
90's chat server system in Node.js
var net = require('net');
var url = require('url');
// Client data
// connected socket
// if this is the chatwindow client -> send messages
var Client = function Client() {
this.socket = null;
this.chatWindow = false;
};
//var input = [3, 1, 88, 6, 2, 2];
var input = [Math.floor(Math.random()*100),Math.floor(Math.random()*100),Math.floor(Math.random()*100),Math.floor(Math.random()*100),Math.floor(Math.random()*100),Math.floor(Math.random()*100)];
var output = [0, 0, 0, 0, 0, 0];
var input_temp = [input[0], input[1], input[2], 255, input[3], input[4], input[5], 255];
// Improvised merge sort
// Sort list from lowest to highest.
@fador
fador / ffmpeg_libav_video_demux_decode_example.cpp
Created January 24, 2019 09:20
ffmpeg / libav demuxing and decoding example using the new API
#include <cstdlib>
#include <cstdio>
#include <cstring>
#ifdef HAVE_AV_CONFIG_H
#undef HAVE_AV_CONFIG_H
#endif
extern "C" {
#include "libavcodec/avcodec.h"
@fador
fador / main.js
Last active April 27, 2017 07:38
Raspberry Pi -> ESP8266 request forward script in Node.js
// Use HTTP module
var http = require('http');
// Define a port we want to listen to
const PORT=8000;
// This function sends requests to the ESP8266
function doRequest(url) {
try {
var req = http.get({
@fador
fador / arc4_brute_search.cpp
Created November 3, 2016 16:43
arc4 hasher in OpenCL for tietoturvahaaste.fi challenge
/*
Copyright (c) 2016, Marko Viitanen (Fador)
Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,

Keybase proof

I hereby claim:

  • I am fador on github.
  • I am fador (https://keybase.io/fador) on keybase.
  • I have a public key whose fingerprint is 16B1 750F 041D 90FB 1999 6224 8B17 6992 57BB BE87

To claim this, I am signing this object: