Skip to content

Instantly share code, notes, and snippets.

@notpeelz
notpeelz / DoubleComparer.cs
Created March 7, 2015 04:42
Floating-point number comparer
readonly Comparer<Double> doubleComparer = Comparer<Double>.Create((x, y) =>
{
long firstValue = BitConverter.DoubleToInt64Bits(x);
long secondValue = BitConverter.DoubleToInt64Bits(y);
// Compare the bit-sign
if (firstValue >> 63 != secondValue >> 63)
return firstValue == secondValue ? 0 : firstValue.CompareTo(secondValue);
long difference = Math.Abs(firstValue - secondValue);
open System
open System.Linq
open ArgumentParser
open ArgumentParser.Reflection
open ArgumentParser.Reflection.POSIX
type private GlobalContext() =
static member public Instance = new GlobalContext()
member public this.Test = null
interface IParserContext with
@notpeelz
notpeelz / portspoof
Last active August 29, 2015 14:25
Portspoof init.d startup script
#DAEMON=/usr/local/bin/portspoof
#CONFIG=/usr/local/etc/portspoof.conf
#SIGNATURES=/usr/local/etc/portspoof_signatures
PS_UNFILTEREDPORTS="53 80 443 49152:65535"
PS_INTERFACES="eth0"
PS_LISTENPORT=4444
PS_USER=daemon
# WARNING: do not use the -D (daemon) option, as it will yield the wrong PID
#PS_ARGUMENTS="-c $CONFIG -s $SIGNATURES"
@notpeelz
notpeelz / veracrypt_mount.sh
Last active September 27, 2016 15:28
VeraCrypt volume (secure) mounting via GUI
#!/bin/bash
DEVICE=/dev/sda1
IMAGE_PATH='/media/$1/Storage/.veracrypt/volume'
MOUNT_PATH='/mnt/volume'
if [[ "$USER" != "root" ]]; then
gvfs-mount -d $DEVICE
gksu -D $(basename $0) $0 $USER
exit $?
@notpeelz
notpeelz / gulpfile.js
Last active November 23, 2015 20:09
ASP.NET MVC Gulpfile
var gulp = require('gulp');
var bowerFiles = require('gulp-main-bower-files');
var runSequence = require('run-sequence').use(gulp);
// Preprocessor & plugins
var plugins = require('gulp-load-plugins')({ camelize: true, lazy: true });
var precss = require('precss');
var autoprefixer = require('autoprefixer');
var mqpacker = require('css-mqpacker');
var csswring = require('csswring');
@notpeelz
notpeelz / index.js
Last active February 22, 2016 00:18
E-Walrus bot
import path from 'path';
import fs from 'fs';
import Discord from 'discord.js';
import request from 'superagent';
import plugins from '~/plugins';
import * as utils from '~/utils.js';
const bot = new Discord.Client();

function* getCommand(content) {
@notpeelz
notpeelz / snippets.cson
Last active March 12, 2016 16:37
Atom snippets.cson
'.source.js':
'React Component Export':
'prefix': 'drc6'
'body': """
import React, { Component, PropTypes } from 'react';
export default class $1 extends Component {
render() {
return (
@notpeelz
notpeelz / crawler.js
Last active May 26, 2021 16:27
Visa requirements Wikipedia crawler
import Crawler from 'crawler';
import url from 'url';
const BASE_ADDRESS = 'https://en.wikipedia.org/';
const COUNTRY_PATTERN = /.*?Visa_requirements_for_(.*?)_citizens.*?/i;
const VISA_REQUIRED_PATTERN = /.*?visa\s+required.*?/i;
const VISA_NOT_REQUIRED_PATTERN = /.*?visa\s+not\s+required.*?/i;
const visaRequirements = {};
@notpeelz
notpeelz / keybase.md
Created April 23, 2017 03:04
keybase.md

Keybase proof

I hereby claim:

  • I am louistakepillz on github.
  • I am peelz (https://keybase.io/peelz) on keybase.
  • I have a public key ASC8UpbEDLbre_Ah6c18QUxnfAFan0hexNc_UxtmskUyGAo

To claim this, I am signing this object:

@notpeelz
notpeelz / .vimrc
Last active March 16, 2018 21:38
Per-tab buffers; don't use this, doesn't work.
" Inspired by https://vi.stackexchange.com/questions/4091/how-to-bind-a-set-of-buffers-to-a-tab
if !exists("g:WindowBufManager")
let g:WindowBufManager= {}
endif
function! InitTabBufferList()
if !has_key(g:WindowBufManager, tabpagenr())
let g:WindowBufManager[tabpagenr()] = []
endif
endfunction