Skip to content

Instantly share code, notes, and snippets.

View Darker's full-sized avatar

Jakub Mareda Darker

  • Czech Republic
View GitHub Profile
@Darker
Darker / gist:0f29836ca7013ee98263
Last active August 29, 2015 14:06
$_SERVER dump
Forgotten what the $_SERVER variable contains? See below:
$_SERVER["COMSPEC"] "C:\windows\system32\cmd.exe"
$_SERVER["CONTENT_LENGTH"] "43"
$_SERVER["CONTENT_TYPE"] "application/x-www-form-urlencoded; charset=UTF-8"
$_SERVER["CONTEXT_DOCUMENT_ROOT"] "C:/xampp/htdocs"
$_SERVER["CONTEXT_PREFIX"]
$_SERVER["DOCUMENT_ROOT"] "C:/xampp/htdocs"
$_SERVER["GATEWAY_INTERFACE"] "CGI/1.1"
@Darker
Darker / stripes.cpp
Created November 23, 2014 21:58
Generate a background and set is as Windows wallpaper
// stripes.cpp : Defines the entry point for the console application.
//
//
// Magick++ demo to generate a simple text button
//
// Copyright Bob Friesenhahn, 1999, 2000, 2001, 2003
//
#define _CRT_SECURE_NO_WARNINGS
#include <Magick++.h>
#include <string>
@Darker
Darker / rapidxml::xml_node_get_children
Created December 8, 2014 22:47
Get rapidxml xml_node children in std::vector
namespace rapidxml {
//I even managed to create it as a template, though I don't understand templates at all
template <class T>
vector<xml_node<T>*> xml_node_get_children(xml_node<T>* node, const char* filter = NULL) {
//This will be returned
vector<xml_node<T>*> children;
for (xml_node<T> *child = node->first_node(); child; child = child->next_sibling())
{
//If filter is ON, only tag name EXACT MATCHES are included
if(filter==NULL || strcmp(filter, child->name())==0)
/* License:
* Open source ftw. I doubt anybody would actually like to use this file.
* But if you want, use it, change it or share it under any license you like.
*/
package autoclick;
//Comment this out if you don't have the library
import com.sun.jna.platform.win32.WinDef;
//Used for exporting rect class as normal rectangle
import java.awt.Rectangle;
@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",
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 / 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
{
@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 / 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 / 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);