Skip to content

Instantly share code, notes, and snippets.

@ishideo
ishideo / scrape_tables.clj
Created April 8, 2021 09:40 — forked from borkdude/scrape_tables.clj
Extract HTML tables with babashka and bootleg
(ns scrape
(:require [babashka.pods :as pods]
[clojure.walk :as walk]))
(pods/load-pod "bootleg") ;; installed on path, use "./bootleg" for local binary
(require '[babashka.curl :as curl])
(def clojure-html (:body (curl/get "https://en.wikipedia.org/wiki/Clojure")))
@ishideo
ishideo / zig_watch.clj
Created April 8, 2021 09:40 — forked from saikyun/zig_watch.clj
babashka command to watch a folder for changes to .zig-files
#!/usr/bin/env bb
(if *command-line-args*
(def in (str (first *command-line-args*)))
(do
(println "Which bin to run?")
(def in (str *input*))))
(println "Watching" "*.zig" "->" (str "./" in))
cat input.tsv |
lein run -m clojure.main -e '
(import [java.net URLEncoder])
(-> *in*
java.io.BufferedReader.
line-seq
(->> (map #(URLEncoder/encode % "UTF-8"))
(clojure.string/join \newline)
println))'
cat input.tsv |
lein run -m clojure.main -e '
(-> *in*
java.io.BufferedReader.
line-seq
(->> (map #(clojure.string/split % #"\t"))
(map #(first %))
(clojure.string/join \newline)
println))'
#!/usr/bin/env bash
cat ip.tsv | parallel -t -j24 --pipe -q awk -F'\t' '{json="curl -s https://sonar.omnisint.io/reverse/" $1 " | jq -cr ."; json | getline output;print $1, output;close(json)}' | tee subdomains.tsv
javascript: (() => {
let text = prompt('Enter comma-separated domains', '');
let lines = text.split(',');
lines.forEach(_ => {
open('https://www.bing.com/search?q="' + _ + '"', '_blank');
});
})();
@ishideo
ishideo / asn
Created June 18, 2020 07:58 — forked from nitefood/README.md
ASN/IP/Route/hostname command line lookup tool to map any network to the corresponding ASN and prefix
#!/bin/bash
############################################################################################################
# ----------------------------------------------------------------------
# ASN/IPv4/Prefix lookup tool. Uses Team Cymru's whois service for data.
# ----------------------------------------------------------------------
# example usage:
# asn <ASnumber> -- to lookup matching ASN data. Supports "as123" and "123" formats (case insensitive)
# asn <IP.AD.DR.ESS> -- to lookup matching route and ASN data
# asn <ROUTE> -- to lookup matching ASN data
[flake8]
ignore = E203, E266, E501, W503, F403, F401
max-line-length = 88
max-complexity = 18
select = B,C,E,F,W,T4,B9
package main
import (
"encoding/json"
"fmt"
)
func main() {
body := map[string]interface{}{
"domain": "amazon.com",
@ishideo
ishideo / localhost.yml
Last active June 19, 2019 00:38
Mac Setup Ansible Playbook
---
- name: Mac Setup
hosts: 127.0.0.1
connection: local
var:
brew_cask_apps:
- qlmarkdown
- qlcolorcode
- quicklook-json
- qlprettypatch