Skip to content

Instantly share code, notes, and snippets.

View akosma's full-sized avatar

Adrian Kosmaczewski akosma

View GitHub Profile

Keybase proof

I hereby claim:

  • I am akosma on github.
  • I am akosma (https://keybase.io/akosma) on keybase.
  • I have a public key ASD3nctEKdTdOtsuicQgUcCHHFIRBrAZQ4_oXfODcBnHqAo

To claim this, I am signing this object:

@akosma
akosma / CMakeLists.txt
Last active March 24, 2017 11:07
Files used for the free book contest
cmake_minimum_required(VERSION 3.6)
project(bookdraw)
set(CMAKE_CXX_STANDARD 14)
set(SOURCE_FILES main.cpp)
add_executable(bookdraw ${SOURCE_FILES})
@akosma
akosma / rsa.cpp
Last active December 17, 2017 22:41
RSA using the C++ interface of the GMP library
/*
CmakeLists.txt:
cmake_minimum_required(VERSION 3.6)
project(rsa)
set(CMAKE_CXX_STANDARD 14)
set(SOURCE_FILES main.cpp)
add_executable(rsa ${SOURCE_FILES})
target_link_libraries(rsa gmpxx gmp)
*/
@akosma
akosma / rsa.c
Last active December 14, 2022 02:37
RSA algorithm in C using the GMP library
/*
CmakeLists.txt:
cmake_minimum_required(VERSION 3.6)
project(rsa)
set(CMAKE_C_STANDARD 11)
set(SOURCE_FILES main.c)
add_executable(rsa ${SOURCE_FILES})
target_link_libraries(rsa gmp)
*/
@akosma
akosma / rsa.php
Last active March 11, 2017 15:16
RSA algorithm (slow, inefficient but easy to read) implemented in PHP.
<?php
// Very, very, VERY inefficient (but clear and easy to follow) implementation
// of encryption and decryption using the RSA algorithm.
// FOR LEARNING PURPOSES ONLY
// Tested with PHP 5.6+
// Uses the BC Math libraries to handle large numbers: http://php.net/manual/en/book.bc.php
// Run on the command line: `$ php RSA.php`
// https://www.reddit.com/r/PHPhelp/comments/1gztrp/question_calculate_modular_multiplicative_inverse/
function mod_inv($a, $b) {
@akosma
akosma / csv_to_deckset.py
Created November 20, 2016 16:25
Script to convert simple CSV files into a Markdown table compatible with Deckset
#!/usr/bin/env python
import csv
import sys
if len(sys.argv) < 2:
print('Requires a file as parameter')
exit(1)
# Courtesy of
@akosma
akosma / webkit.swift
Created October 24, 2016 07:55
Small command-line macOS application using Swift
#!/usr/bin/env xcrun swift
// Adapted from
// https://forums.developer.apple.com/thread/5137
// https://joearms.github.io/2016/01/04/fun-with-swift.html
import WebKit
class ApplicationDelegate: NSObject, NSApplicationDelegate {
internal var window: NSWindow
@akosma
akosma / set.swift
Created September 3, 2014 13:20
Set operations described in Swift using operators and NSSet instances
// Set operations taken from
// https://en.wikipedia.org/wiki/Set_(mathematics)
import Foundation
// The empty set
let Ø = NSSet()
// The "Universal" set
let U = NSMutableSet()
@akosma
akosma / download.php
Created October 9, 2013 18:54
This script generates a ZIP file with the contents of the current folder, without including files ending in *.zip, .DS_Store or this script itself. To actually request the file, call it using the "?download" key after the script name. This will generate and download the file immediately. It can also generate its own HTML5 manifest, so that the j…
<?php
/*
* Author: Adrian Kosmaczewski.
* License: BSD.
*
* This script generates a ZIP file with the contents of the current folder,
* without including files ending in *.zip, .DS_Store or this script itself.
*
* To actually request the file, call it using the "?download" key after the
* script name. This will generate and download the file immediately.