Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am ian-bartholomew on github.
  • I am oldmeaty (https://keybase.io/oldmeaty) on keybase.
  • I have a public key ASD_MZVi6C3yqV3sGvBkgWLp-rTMi0SteZnKU3EFapwoDgo

To claim this, I am signing this object:

@ian-bartholomew
ian-bartholomew / cjsx.md
Last active August 2, 2017 18:46
CJSX -> JSX/ES6

Dependencies

Depercolator

React codemon

Usage

To transpile cjsx to jsx: depercolate --prefer-const <filename>

To then update the jsx to the newest React API (info):

@ian-bartholomew
ian-bartholomew / vimdiff.md
Created May 6, 2017 00:42 — forked from mattratleph/vimdiff.md
vimdiff cheat sheet

vimdiff cheat sheet

##git mergetool

In the middle file (future merged file), you can navigate between conflicts with ]c and [c.

Choose which version you want to keep with :diffget //2 or :diffget //3 (the //2 and //3 are unique identifiers for the target/master copy and the merge/branch copy file names).

:diffupdate (to remove leftover spacing issues)

:only (once you’re done reviewing all conflicts, this shows only the middle/merged file)

@ian-bartholomew
ian-bartholomew / main.tf
Last active August 26, 2019 19:08
Terraform Hello World
provider "aws" {
region = "us-east-1"
}
resource "aws_security_group" "instance" {
name = "terraform-example-instance"
ingress {
from_port = "${var.server_port}"
to_port = "${var.server_port}"
@ian-bartholomew
ian-bartholomew / zap_cli_scan.sh
Last active January 18, 2022 19:48
script to run owasp zap cli
#!/bin/sh
DOCKER=`which docker`
IMAGE='owasp/zap2docker-weekly'
URL='https://www.example.com'
ZAP_API_PORT='8090'
# Start our container
CONTAINER_ID=`$DOCKER run -d \
-p $ZAP_API_PORT:$ZAP_API_PORT \
@ian-bartholomew
ian-bartholomew / recursive-factorial.js
Last active March 1, 2017 06:45
Recursive factorial function
/*
A function that computes a factorial recursively.
A factorial is when you take a number n and multiply by each preceding integer until you hit one.
n * (n-1) * (n-2) ... * 3 * 2 * 1
Call the function factorial
factorial(1) = 1
factorial(2) = 2
factorial(3) = 6
@ian-bartholomew
ian-bartholomew / vim-cheat-sheet.md
Last active April 7, 2019 20:19
Vim cheat sheet

Vim cheat sheet

Movement / Range

Word

w next word 
b prev word 
W next WORD 
B prev WORD 

e end of word

@ian-bartholomew
ian-bartholomew / tmux-cheat-sheet.md
Last active April 7, 2019 20:19
Tmux Cheat Sheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Basic

start new:

 tmux

start new session with name:

function order(words){
// return empty string for undefined
if (words === undefined) {
return '';
}
let rval = [];
let pieces = words.split(' ');
for (let i=0; i<10; i++) {
if (pieces.hasOwnProperty(i)) {
@ian-bartholomew
ian-bartholomew / crawl.rb
Last active October 2, 2015 20:19
site crawler ruby script with spidr https://github.com/postmodern/spidr
#!/usr/bin/env ruby
require 'rubygems'
require 'csv'
require 'spidr'
CSV.open('pets_crawl.csv', 'wb') do |csv|
csv << ['page title', 'page url']
Spidr.site('http://www.petsmart.com', :ignore_links => [/gsi/]) do |spider|
spider.every_html_page do |page|