Skip to content

Instantly share code, notes, and snippets.

@tscheepers
tscheepers / crypto_n_ceasar.hs
Last active January 27, 2021 14:10
Simple cryptography problem in Haskell. It is an English text, encrypted by using N Caesar ciphers, each with its own key. The 1st, (N+1)th, (2*N+1)th, and so on letters are all encrypted using the first Caesar cipher; the 2nd, (N+2)th, (2*N+2)th, and so on with the second cipher, and so on. N is a small positive integer. Spaces and punctuation …
import Prelude
import Data.List
import Data.Ord
-- It is an English text, encrypted by using N Caesar ciphers, each with its own key.
-- The 1st, (N+1)th, (2*N+1)th, and so on letters are all encrypted using the first Caesar cipher; the 2nd, (N+2)th, (2*N+2)th, and so on with the second cipher, and so on. N is a small positive integer. Spaces and punctuation have been removed before encryption.
ceaser = decrypt "xsjztliyjvphmamicnwlriemsotjpsgcdtensyyllyydjwlxicnidtjonjqjvpsxnfidfvnntsjvdgedjhzsxsjppyxpwwzkevjchtvonxtxednqaqiqtvxtjatpjfpamemjxthwfgwenxfymzsxsjztliyjvphmamicmedgipsvpnrgjrejhxfrjymxjwemixjxsthhfwzwmrnrlqpjiidhvtgiogcrnsgfrmfxtxxlgiwfwznrsnwqnjejiykmqycemvpjfztowfgtkvliiwxmrlmzaeygeenweffpqedtlzbigjvemidhlprihfwwfxpwqtxeeyvtgyejhetfwfmdjhpamrjrpwitsxsjrtsiejiyylnjrezvjfronwytahnhpqcvsshsedylpamrjrpwinntsjvemmdhmamicnwhjpwprzbrmjglzwpbltqitymdjeddxzzrojvdyeyieyimxuppriyymetjejrlutpfvdysmjktsrpwwetfpzrmwilpemqiemmdjecsionxemiojwnwmaymzspphltkjcjmyiinmmqkvlgppkvpsgskscylpzrmwilpemqinntsjvntrdjufj
@tscheepers
tscheepers / GeoSpatialThingController.php
Last active August 11, 2021 04:45
Geospatial sort by distance using Laravel and MySQL. I'm using a point column named geolocation in a table called things.
<?php
class GeoSpatialThingController extends \BaseController {
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
@tscheepers
tscheepers / CodeCoverage.php
Last active January 27, 2021 14:11
Laravel and Laravel Behat Extension code coverage trait
<?php
trait CodeCoverage {
/**
* @var PHP_CodeCoverage
*/
protected static $coverage;
/**
* @BeforeSuite
@tscheepers
tscheepers / producer_consumer.py
Created April 5, 2021 11:42
Producer-Consumer pattern in Python with threading
'''
Producer-Consumer pattern in Python with threading.
Be aware! This is not true parallel computing because of the GIL.
'''
import logging
import time
from threading import *
from queue import Queue
{
"openapi": "3.0.0",
"info": {
"title": "Keeping API Documentation",
"version": "v1",
"x-logo": {
"url": "https://developer.keeping.nl/images/logo.svg",
"altText": "Keeping logo"
},
"description": "# Introduction\nReady to create an integration with [Keeping](https://keeping.nl)? Developers can use our [RESTful](https://en.m.wikipedia.org/wiki/Representational_state_transfer) API to manipulate time entries programmatically, fetch reports, manage users, projects, tasks and clients. Use the API by communicating with the accompanying web service over [HTTPS](https://en.wikipedia.org/wiki/HTTPS) at `api.keeping.nl/v1`. The [JSON](https://en.wikipedia.org/wiki/JSON) format is used for both request and response bodies.\n\n## Quick start \n\nTo obtain quick access to the web service, and start using the API, navigate to [**Developer**](https://keeping.nl/account/developer) under **My account** within Keeping. There you can either generate a personal access token to try the API yo