Skip to content

Instantly share code, notes, and snippets.

@notpeelz
notpeelz / RenderCondition.js
Last active April 5, 2022 20:21
react-router conditional rendering using negative route matching
import React from 'react'
import PropTypes from 'prop-types'
import { Route, Switch } from 'react-router-dom'
const generateRouteId = (() => {
let i = 0
return (name) => {
return `${name}-${i}`
}
})()
@notpeelz
notpeelz / AppRoute.js
Last active March 17, 2018 02:06
react-router wrapper for off-path conditional rendering. Lightweight alternative: https://gist.github.com/LouisTakePILLz/a5336b0d02aa634f03bcd70ee12c484d
import React from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { Route } from 'react-router-dom'
import { fromJS } from 'immutable'
import { setCurrentRoutes } from './actions'
@connect(
@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
@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 / 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 / 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 / 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 / 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 / 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 / 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"