Skip to content

Instantly share code, notes, and snippets.

View sammcgrail's full-sized avatar
🎯
Focusing

Sam McGrail sammcgrail

🎯
Focusing
View GitHub Profile
@sammcgrail
sammcgrail / trash.sh
Created August 13, 2020 14:24 — forked from geek-at/trash.sh
The script used to trash a banking phishing site
#!/bin/bash
while :; do
verf=$(cat /dev/urandom | tr -dc '0-9' | fold -w 8 | head -n 1)
pin=$(cat /dev/urandom | tr -dc '0-9' | fold -w 5 | head -n 1)
ip=$(printf "%d.%d.%d.%d\n" "$((RANDOM % 256))" "$((RANDOM % 256))" "$((RANDOM % 256))" "$((RANDOM % 256))")
@sammcgrail
sammcgrail / curl_post_json.md
Created May 22, 2018 17:51 — forked from ungoldman/curl_post_json.md
post a file JSON file with curl

How do POST file with curl??

You can post a json file with curl like so:

curl -X POST -H "Content-Type: application/json" -d @FILENAME DESTINATION

so for example:

@sammcgrail
sammcgrail / brush_redraw_vertical_axis.js
Created May 16, 2016 21:05 — forked from samselikoff/brush_redraw_vertical_axis.js
Brush function for d3.js that redraws the vertical axis based on the range of data currently shown
function brush() {
// Use x.domain to filter the data, then find the max and min duration of this new set, and set y.domain to that
x.domain(brush.empty() ? x2.domain() : brush.extent());
var dataFiltered = data.filter(function(d, i) {
if ( (d.date >= x.domain()[0]) && (d.date <= x.domain()[1]) ) {
return this;
}
})
var buildersFiltered = color.domain().map(function(name) {
return {
@sammcgrail
sammcgrail / README.mkd
Created April 26, 2016 20:37 — forked from christophermanning/README.mkd
Hamiltonian Graph Builder
<style type="text/css">p {text-align:center;width: auto}</style>

Created by Christopher Manning

Gallery

Axle Eight [Fibbobaci](http://bl.ocks.org/d/1703449/#/[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169]43/0/1) [Florets](http://bl.ocks.org/d/1703449/#/

@sammcgrail
sammcgrail / vim-cheat-sheet.md
Created February 18, 2016 22:21 — forked from ummahusla/vim-cheat-sheet.md
Vim Cheat Sheet

Modes

Vim has two modes insertion mode and command mode. The editor begins in command mode, where the cursor movement and text deletion and pasting occur. Insertion mode begins upon entering an insertion or change command. [ESC] returns the editor to command mode (where you can quit, for example by typing :q!). Most commands execute as soon as you type them except for "colon" commands which execute when you press the ruturn key.

Quitting

  • :x Exit, saving changes
  • :q Exit as long as there have been no changes
  • ZZ Exit and save changes if any have been made
  • :q! Exit and ignore any changes

Inserting Text

@sammcgrail
sammcgrail / flask_ajax.py
Created December 22, 2015 18:31 — forked from MalphasWats/flask_ajax.py
Making a basic AJAX request with Flask
# Answer to a question on Flask mailing list
# http://librelist.com/browser//flask/2012/6/30/using-ajax-with-flask/
# NOTE: *REALLY* don't do the thing with putting the HTML in a global
# variable like I have, I just wanted to keep everything in one
# file for the sake of completeness of answer.
# It's generally a very bad way to do things :)
#
from flask import (Flask, request, jsonify)
app = Flask(__name__)
@sammcgrail
sammcgrail / ember-resources.md
Last active August 29, 2015 14:27 — forked from thomascchen/ember-resources.md
Ember Resources

Resources for Learning Ember.js

Here's a list of resources that have been helpful for me in getting acquainted with Ember.js, in no particular order. Ember is relatively young and changing really fast, so I found that searching for answers on Google and Stack Overflow was not quite as easy as it is with Rails. Try to stick with resources that have been written in the past few months. Look at the older stuff too but remember that things have likely changed.