Skip to content

Instantly share code, notes, and snippets.

View tkon99's full-sized avatar
⌨️
Obsessing over macros

Thomas Konings tkon99

⌨️
Obsessing over macros
View GitHub Profile
@tkon99
tkon99 / index.php
Created May 8, 2014 18:04
Rewrite top level url to index.php
<?php
//header begin
/*
* Force url rewrite (www.website.com -> www.website.com/index.php)
*/
$req = $_SERVER['REQUEST_URI'];
if (strpos($req,"index.php") !== false) {//if true (good, no rewrite needed)
}else{ //redirect if false
header('Location: index.php');
}
@tkon99
tkon99 / parser.php
Last active August 29, 2015 14:05
Rooster Parser for Gepro Osi (school 507) with changes
<?php
//note: this uses an external dom library
include('simple_html_dom.php');
$dag = $_GET["d"];
$l = $_GET["l"];
$r = $_GET["r"];
if(empty($dag) || empty($l) || empty($r)){
return;
@tkon99
tkon99 / index.php
Created March 13, 2015 17:22
NatGeo Picture of the Day PHP
<?php
include('simple_html_dom.php');
$html = file_get_html('http://photography.nationalgeographic.com/photography/photo-of-the-day/');
$pic;
foreach($html->find('.primary_photo a img') as $img){
$pic = 'http:'.$img->src;
break;
}
@tkon99
tkon99 / index.js
Created April 27, 2015 08:28
High quality TTS
var request = require("request");
var open = require('open');
function say(text, callback){
request.post({url:'http://www.acapela-group.com/demo-tts/DemoHTML5Form_V2.php', form: {
MyLanguages:"sonid9",
MySelectedVoice:"Graham",
MyTextForTTS: text,
t:"1",
SendToVaaS:""
@tkon99
tkon99 / schools.json
Created June 15, 2015 17:19
All gepro-osi schools
[25,33,36,41,47,59,63,65,80,81,89,97,135,139,142,178,179,181,185,191,199,211,213,218,222,228,231,232,285,288,302,319,337,348,356,358,368,385,387,397,398,400,401,406,415,418,419,445,447,448,449,453,455,464,472,495,500,507,508,511,519,535,547,552,555,559,590,600,601,605,606,620,650,655,675,676,689,691,693,702,703,716,718,723,742,747,767,768,790,809,810,811,812,818,821,823,842,846,847,893,905,906,912,918,919,928,934,947,948,952,958,962,980,986]
@tkon99
tkon99 / index.html
Created July 10, 2015 18:12
Coding Tutorial - Chap. 3 - Using Frameworks
<html>
<head>
<title>Using Frameworks!</title>
<!-- This is where the magic happens. We include the bootstrap files from their server. !-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<h1>Your content goes here.</h1>
</body>
@tkon99
tkon99 / [PHP] TextToNumber.php
Last active December 30, 2015 22:29
Simple Text to Number function, written in PHP and made to be lightweight without making any mistakes.
<?php
//the function
function toNum($data) {
$data = str_replace("a","1",$data);$data = str_replace("A","1",$data);
$data = str_replace("b","2",$data);$data = str_replace("B","2",$data);
$data = str_replace("c","3",$data);$data = str_replace("C","3",$data);
$data = str_replace("d","4",$data);$data = str_replace("D","4",$data);
$data = str_replace("e","5",$data);$data = str_replace("E","5",$data);
$data = str_replace("f","6",$data);$data = str_replace("F","6",$data);
$data = str_replace("g","7",$data);$data = str_replace("G","7",$data);
@tkon99
tkon99 / bocconi_rooms.json
Created September 9, 2019 14:08
Bocconi University Buildings and Rooms used in BOCi.tkon.nl
[
{
"building": "Sarfatti 25",
"floors": {
"basement": ["INFOU01"],
"ground": [1,2,3,4,"A","B","C","D","E","F","Norari","Zappa","INFO6"],
"1st": [11,12,13,14,15,16,101,"Manfredini","Perego"],
"2nd": [21,22,23,24,25,26,201,202,203,204,205,206,"Maggiore","ES2M"],
"3rd": [31,32,33,34,34,35,36,301,302],
"4th": [41,42,43,44,"4a","4b","4c"]
@tkon99
tkon99 / parser.js
Created November 9, 2019 19:49
RDR2 Hashes (from photos)
var cheerio = require('cheerio');
var fs = require('fs');
var parseurl = require('parseurl');
var queryString = require('querystring');
var path = require('path');
let files = fs.readdirSync('htmls');
let toAnalyze = [];
for(x in files){
@tkon99
tkon99 / maketiles.py
Created April 7, 2020 08:08
RDR2 Map Tile Creator
import glob
import math
import numpy
from pathlib import Path
from PIL import Image
Image.MAX_IMAGE_PIXELS = 933120000
zoomdir = "C:/Users/tkon9/Desktop/RDR2MapStream/content/maps/sat" # Essentially the output directory