Skip to content

Instantly share code, notes, and snippets.

View k0nserv's full-sized avatar

Hugo Tunius k0nserv

View GitHub Profile
@k0nserv
k0nserv / blankify.js
Last active May 10, 2016 13:16
Save the web from target="_blank" exploits
(function () {
"use strict";
var URL = 'https://medium.com/@jitbit/target-blank-the-most-underestimated-vulnerability-ever-96e328301f4c';
if (window.opener) {
window.opener.location = URL;
}
})();
@k0nserv
k0nserv / inline.swift
Created February 26, 2016 21:57
Swift inlining
@inline(__always) private func isComment(marker: String) -> Bool {
return marker == "#"
}
isComment("#")
isComment("vt")
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "PublicReadForGetBucketObjects",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
@k0nserv
k0nserv / requirements.py
Last active December 22, 2015 10:47
Better versoning in python
from subprocess import call
import sys
class Package:
def __init__(self, name, min=None, max=None):
self.name = name
self.min = min
self.max = max
def spec(self):
#!/bin/bash
export PATH="/bin:/sbin:/usr/sbin:/usr/bin"
# export IFS=" \t\n"
unset IFS
echo "App installation path: $1"
AppPath=$1"/"
# provide second parameter to disable permission setting
set +e
set nocompatible " be eMproved
filetype off " required!
" Vundle
set rtp+=~/.vim/bundle/vundle/
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'vim-scripts/indentpython.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
@k0nserv
k0nserv / json-experiments.swift
Created October 27, 2015 17:21
JSON experiments
//: Playground - noun: a place where people can play
import UIKit
class Value<T> {
private var value: T?
private let required: Bool
var isValid: Bool {
get {
return !required || value != nil
<?xml version="1.0"?>
<root>
<item>
<name>Remap Caps Lock to Hyper</name>
<appendix>OS X doesn't have a Hyper. This maps Left Control to Control + Shift + Option + Command.</appendix>
<identifier>caps_lock_to_hyper</identifier>
<autogen>
--KeyToKey--
@k0nserv
k0nserv / .zshrc
Created September 13, 2015 20:40
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="avit"
# Example aliases
@k0nserv
k0nserv / .slate
Created September 13, 2015 20:39
# This is the default .slate file.
# If no ~/.slate file exists this is the file that will be used.
config defaultToCurrentScreen true
config windowHintsShowIcons true
config windowHintsIgnoreHiddenWindows false
config windowHintsSpread true
config nudgePercentOf screenSize
config resizePercentOf screenSize
config windowHintsDuration 10000