Skip to content

Instantly share code, notes, and snippets.

View donfanning's full-sized avatar
🗃️
Holding up libraries and robbing them blind for the future.

Don Fanning donfanning

🗃️
Holding up libraries and robbing them blind for the future.
View GitHub Profile
@donfanning
donfanning / phrase.rb
Created August 20, 2018 01:08 — forked from codatory/phrase.rb
Fuzzy string matching convenience class
require 'fuzzystringmatch'
class Phrase
attr_reader :matches
def initialize(str, match_score=0.8)
@str = str
@matches = []
@match_score = match_score
@scorer = FuzzyStringMatch::JaroWinkler.create
@donfanning
donfanning / fuzzy_match.rb
Created August 20, 2018 01:08 — forked from codatory/fuzzy_match.rb
Fuzzy Matching Library
class FuzzyMatch
class Matcher
require 'singleton'
require 'fuzzystringmatch'
include Singleton
JW = FuzzyStringMatch::JaroWinkler.create
def self.get_score(str1,str2)
JW.getDistance(str1,str2)
end
# Execution-Policy Not-Annoying
Update-ExecutionPolicy Unrestricted
# Remote admin is a good thing
Enable-RemoteDesktop
# Permanently install Chocolatey for updates and more packages later on
cinst -y chocolatey
# Why waste vertical screen space?
#! /usr/local/env ruby
require "uri"
#####################
## ____ _ _
## / ___|___ _ __ ___| |_ __ _ _ __ | |_ ___
## | | / _ \| '_ \/ __| __/ _` | '_ \| __/ __|
## | |__| (_) | | | \__ \ || (_| | | | | |_\__ \
## \____\___/|_| |_|___/\__\__,_|_| |_|\__|___/
@donfanning
donfanning / update.rb
Created August 20, 2018 01:02 — forked from codatory/update.rb
Build CIDR lists of bad hosts
#!/usr/local ruby
lists = {
blocklist_de: "https://lists.blocklist.de/lists/all.txt",
tor_exit: "https://www.dan.me.uk/torlist/?exit",
dshield: "http://feeds.dshield.org/block.txt",
spamhaus: "https://www.spamhaus.org/drop/drop.txt"
}
lists.each do |name,url|
@donfanning
donfanning / server-to-insights.js
Created August 15, 2018 16:30 — forked from kenahrens/server-to-insights.js
This script can be used in NR Synthetics to copy Server Metrics into Insights Events.
/** API SETUP - remove this section to run in New Relic Synthetics **/
if ($http == null) { var $http = require('request'); }
/** API SETUP - remove this section to run in New Relic Synthetics **/
// Global variables we'll need
var config = {
'SCRIPTNAME': 'apm-server-to-insights',
'VERSION': '1.0.2',
'EVENT_NAME': 'ServerData',
'ACCOUNT_ID': 'xxx',
@donfanning
donfanning / nr_query_analyzer.rb
Created August 15, 2018 16:25 — forked from damon/nr_query_analyzer.rb
takes a paste of query statements from New Relic and explains all of them ; also converts UPDATEs and DELETEs now
#!/usr/bin/env ruby
puts "NR Bulk Query Explainer"
puts "make sure to adjust the mysql command line in the script to your local setup"
puts "Paste your SQL Statements Trace from New Relic and ~ and RETURN to submit."
cli = "mysql -uroot notes_from_scratch -e "
strings,queries = [],[]
while (s=gets)!="~\n"
strings << s
end
@donfanning
donfanning / proxy-scraper.sh
Created August 15, 2018 14:56 — forked from KyxRecon/proxy-scraper.sh
Parallel Proxy Scraper & Checker Tool /
#!/bin/bash
# HR Proxy Scraper Script
# Rebuilded By Kyxrec0n
# Demo video : youtube.com/watch?v=iXCeR_XsP6o
# USAGE: ./proxy-scraper.sh <ARGUMENT> <OPTIONS>
# ARGUMENTS:
# Proxy Checker - Single Proxy Check
# -s <IP>:<PORT>
#
# Proxy Checker - List Scan:
@donfanning
donfanning / items.py
Created August 15, 2018 14:42 — forked from devvartpoddar/items.py
Webscraping with Python
# -*- coding: utf-8 -*-
import scrapy
class SpiegelItem(scrapy.Item):
source = scrapy.Field()
date = scrapy.Field()
nchar = scrapy.Field()
text = scrapy.Field()
@donfanning
donfanning / scrape4_mysql.pl
Created August 15, 2018 14:42 — forked from cofearabi/scrape4_mysql.pl
get stock data from yahoo and put them into mysql database server
#!/usr/bin/perl
use strict;
use warnings;
use Web::Scraper;
use URI;
use Encode;
# use Spreadsheet::WriteExcel;
use strict;
use warnings;
use utf8;