Skip to content

Instantly share code, notes, and snippets.

View Darker's full-sized avatar

Jakub Mareda Darker

  • Czech Republic
View GitHub Profile
const RICKROLL = "https://www.youtube.com/watch?v=oHg5SJYRHA0";
const RICKROLL_DAY = 1;
const RICKROLL_MONTH = 4;
if(Storage && window.localStorage && window.localStorage instanceof Storage) {
// Check if it's 1st of April
var date = new Date();
// Note that months are zero indexed
if(date.getDate() == RICKROLL_DAY && date.getMonth() == RICKROLL_MONTH-1) {
// If local storage does not work, rickroll will simply never occur
// this is a safety measure to prevent people being rickrolled forever
@Darker
Darker / HomeworkTestBase.java
Last active March 8, 2017 17:16
Example of JUnit test for CTU PJV homework assignment 01
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package test;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
@Darker
Darker / KOS_multiple_tabs.user.js
Created February 3, 2017 18:46
Userscript to allow students of CTU to open multiple tabs of KOS
// ==UserScript==
// @name KOS multiple tabs
// @namespace util
// @description Allows you to use KOS in mutiple tabs.
// @include https://www.kos.cvut.cz/kos/*
// @version 1
// @grant none
// ==/UserScript==
// Name of local storage entry where page id is stored
const DATA_NAME = "KOS_PAGE_ID";
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title>PyPy</title>
</head>
<body>
<h2>Select python file</h2>
<input type="file" id="files" name="file" multiple />
@Darker
Darker / main.js
Created November 8, 2016 22:21
My experiment with express, facebook api and other libraries I don't understand...
/**
* Module dependencies.
*/
var express = require('express')
, graph = require('fbgraph');
var app = express();
var server = require("http").createServer(app);
@Darker
Darker / test_hw.py
Created October 7, 2016 08:09
Python script to test C file against required input and output
# Homework tester script
# ----------------------
# This script will automatically (try to) test
# IO of your homework.
#
# Requirements:
# Python 2.7 In order to use Python 3, change `raw_input` to `input`
# gcc compiler
#
# Parameters:
@Darker
Darker / prepare.bat
Created October 4, 2016 23:29
Prepare CTU (CVUT) programming homework assignment for upload
@echo off
set FILETOZIP=%1
echo Selected file: %FILETOZIP%
set TEMPDIR=TMP
echo Creating temporary file directory .\%TEMPDIR%
mkdir %TEMPDIR%
copy %FILETOZIP% %TEMPDIR%\main.c
@Darker
Darker / click_left.ahk
Created June 26, 2016 10:51
Auto hotkey - click left button once per second
toggle=0
F12::
If (toggle := !toggle)
SetTimer, Timer, -1
return
timer:
while toggle
{
const readline = require('readline');
var oldCreateIface = readline.createInterface;
readline.createInterface = function() {
var iface = oldCreateIface.apply(this, arguments);
var oldQuestion = iface.question;
iface.question = function(question) {
var promise = Promise.defer();
oldQuestion.call(this, question, (result)=>{
@Darker
Darker / gist:02d51981caa6f14cd825
Created February 14, 2015 01:42
Post AJAX information format on boards for league of legends
{
"id":"0000",
"message":"TEXT",
"badWordReplacements":null,
"user":{
"id":"USER_ID",
"name":"SUMMONER_NAME",
"lolSummonerLevel":"LEVEL (0-30)",
"lolProfileIcon":"PROFILE_ICON_ID",
"realm":"NA/EUNE/EUW/OCE",