{"id":13563992,"url":"https://github.com/shawwn/scrap","last_synced_at":"2025-04-03T02:11:58.372Z","repository":{"id":41272177,"uuid":"124594531","full_name":"shawwn/scrap","owner":"shawwn","description":"Nearly a thousand bash and python scripts I've written over the years.","archived":false,"fork":false,"pushed_at":"2024-03-26T06:09:51.000Z","size":752,"stargazers_count":114,"open_issues_count":0,"forks_count":18,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-04-26T14:05:52.278Z","etag":null,"topics":["bash","cli"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shawwn.png","metadata":{"files":{"readme":"README.md","changelog":"changedir","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-09T21:20:54.000Z","updated_at":"2024-06-07T20:10:37.116Z","dependencies_parsed_at":"2023-11-23T04:40:51.677Z","dependency_job_id":"92f001ed-a69a-47aa-971b-c1bb2e1e63a1","html_url":"https://github.com/shawwn/scrap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shawwn%2Fscrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shawwn%2Fscrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shawwn%2Fscrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shawwn%2Fscrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shawwn","download_url":"https://codeload.github.com/shawwn/scrap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246922248,"owners_count":20855345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","cli"],"created_at":"2024-08-01T13:01:25.343Z","updated_at":"2025-04-03T02:11:58.353Z","avatar_url":"https://github.com/shawwn.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# scrap\n\nVarious scripts I've written over the years.\n\n## installation \n\n```\ngit clone https://github.com/shawwn/scrap ~/scrap\n\n# add scrap to PATH\necho 'export PATH=\"${HOME}/scrap:${PATH}\"' \u003e\u003e ~/.bashrc\necho 'export PATH=\"${HOME}/scrap:${PATH}\"' \u003e\u003e ~/.zshrc\n```\n\n## examples\n\n## `mkbin \u003cname\u003e`\nMake a new scrap script with a predefined bash template.\nIf `\u003cname\u003e` already exists, the script is edited instead.\nIf you save an empty file, the script is deleted.\n\n## `mkpy \u003cname\u003e`\nMake a new scrap script with a predefined python template.\nIf `\u003cname\u003e` already exists, the script is edited instead.\nIf you save an empty file, the script is deleted.\n\n### `math \u003cexpr\u003e`\n\nEvaluate math.\n```\n$ math 60*60\n3600\n$ math 2^64/2^60\n16.0000\n$ math '2^64/2^(60+1)'\n8.0000\n```\n\n### `narrow [filter1] [filter2] ....`\n\nFilter lines by each filter.\n\nA filter is a python regex. NOTE: You must explicitly put whitespace within `[ ]`.\n\nFor each line, the line is discarded unless it matches the filter.\n\nIf a filter starts with `!`, all lines are kept except those matching the filter.\n\nThe general idea is that you can do `\u003csome command\u003e | narrow foo` to see all lines containing foo,\nand `\u003csome command\u003e | narrow foo bar` to see all lines containing foo and bar, and so on.\n\nThis is a very easy way of trimming down output to exactly what you care about.\n\n```\n$ ls -1 /\nbin\nboot\ndev\netc\nhome\ninit\nlib\nlib64\nmedia\nmnt\nopt\nproc\nroot\nrun\nsbin\nsnap\nsrv\nsys\ntmp\nusr\nvar\n$ ls -1 / | narrow lib\nlib\nlib64\n$ ls -1 / | narrow '^[bdl]'\nbin\nboot\ndev\nlib\nlib64\n$ ls -1 / | narrow 'bin|lib|tmp'\nbin\nlib\nlib64\nsbin\ntmp\n$ ls -1 / | narrow 'bin|lib|tmp' 'ib|bi'\nbin\nlib\nlib64\n$ ls -1 / | narrow 'bin|lib|tmp' 'ib|bi' \"\\!lib\"\nbin\n```\n\n### llbin [filter1] [filter2] ...\nList all scrap scripts.\n\n```\n# all the scrap scripts containing `mk`\n$ llbin mk\nmkalias\nmkalias2\nmkbash\nmkbin\nmkbranch\nmkbranch-local\nmkcd\nmkmod\nmkpy\nmkpy-basic\n```\n\n```\n# all the scrap scripts containing `git`\n$ llbin git\ngit-3way\ngit-3way-rm\ngit-alldiff\ngit-branch-current\ngit-branch-rm\ngit-branch-rm-remote\ngit-checkout\ngit-clone-from-commit\ngit-commit\ngit-commit-message-last\ngit-commit-undo\ngit-diff-show-all\ngit-diff-show-all-single-commit\ngit-discard\ngit-keep-ours\ngit-keep-theirs\ngit-key\ngit-list-files\ngit-list-objects\ngit-log\ngit-log2\ngit-merge\ngit-merge-to\ngit-merge-to-master\ngit-nuke\ngit-nuke-commits\ngit-patch-apply\ngit-patch-from-commit\ngit-patch-from-last-commit\ngit-pr-fetch\ngit-pr-fetchall\ngit-repush\ngit-revert\ngit-review-all-changes-just-merged\ngit-status\ngit-stdout\ngit-unpush-last-commit\ngit-unstage\ngithub-branch-create\ngithub-branch-create-local\ngithub-clone-and-add-remote\ngithub-image-host\ngithub-image-hostall\ngithub-shorten-url\ngithub-subtree-create\ngithub-subtree-pull\n```\n\n# Complete listing of all scripts\n```\n$ llbin\n1st\n2nd\n3rd\nack2\nagc\nagcolor\nag-filenames-only\napps\nargs\nb64dec\nb64enc\nbackupbin\nbackupdir\nbeautify\nbeautify-portscan\nbeyond-compare\nbeyond-compare-wait\nbin-bin\nbindir\nbindirs\nbin-edit\nbin-find\nbin-find1\nbin-find-exact\nbinlink\nbin-path\nbin-paths\nbins\nbranch\nbrewpath\nbrews\nbrewurl\nbytes2human\ncant-eject\nccode\ncdbin\ncdbranch\ncdmvim\nchangedir\ncleardns\ncls\ncmd\ncmd2\ncodefiles-c\ncodegrep\ncoff\ncollapse-blanks\ncols\ncolumnize\ncomparefiles\ncontains\ncpbin\ncpcmd\ncpp-classes\ncputemp\nctrlc\nctrlctrim\nctrlv\ncuMSP\ncurl-get-with-headers\ncurlquote\ncut-before\nddgui\nddpv\ndecrypt\ndlls\nduh\neachline\neachnull\nechoargs\necho-stdin\nedbin\nedit\nedit2\neditft\nencrypt\nenum-hashes\nexist\nexists\nextract-urls\nexts\nfileext\nfileexts\nfileinfo-check-arch\nfiles\nfilesize\nfindf\nfirst\nfirstlast\nfirst\nflags\nfoo\nforeach-line\nfromhex\nfromhex2\nft\nga\ngac\ngacm\ngc\ngca\ngcgh\ngcm\ngco\ngcu\ngd\ngd1\ngdn\ngdns\ngh\nghc\nghclone\ngit-3way\ngit-3way-rm\ngit-alldiff\ngit-branch-current\ngit-branch-rm\ngit-branch-rm-remote\ngit-checkout\ngit-clone-from-commit\ngit-commit\ngit-commit-message-last\ngit-commit-undo\ngit-diff-show-all\ngit-diff-show-all-single-commit\ngit-discard\ngithub-branch-create\ngithub-branch-create-local\ngithub-clone-and-add-remote\ngithub-image-host\ngithub-image-hostall\ngithub-shorten-url\ngithub-subtree-create\ngithub-subtree-pull\ngit-keep-ours\ngit-keep-theirs\ngit-key\ngit-list-files\ngit-list-objects\ngit-log\ngit-log2\ngit-merge\ngit-merge-to\ngit-merge-to-master\ngit-nuke\ngit-nuke-commits\ngit-patch-apply\ngit-patch-from-commit\ngit-patch-from-last-commit\ngit-pr-fetch\ngit-pr-fetchall\ngit-repush\ngit-revert\ngit-review-all-changes-just-merged\ngit-status\ngit-stdout\ngit-unpush-last-commit\ngit-unstage\ngl\ngl1\ngm\ngp\ngpul\ngreps\ngs\ngs2\ngsa\ngu\ngzip-size\nhasbang\nhashing\nhex2ip\nhfsslower.d\nhs\nhttp-beautify\nhttp-body\nhttp-headers\nhuman2bytes\nhumansizesort\nicgrep\nigrep\ninfopystdin\ninitialtext\ninstall-homebrew\niosnoop-show-full-paths_but-only-shows-calls-to-open\nip2cidr\nips\nirgrep\nisort\niterm\njoinlines\njslib\njson-beautify\nkey2rsa\nkeygen\nkeys\nkill-chrome-helpers\nkill-tunnelblick\nl\nl1\nl-1\nl2\nl3\nl4\nl5\nlall\nlast\nlastfirst\nlib-changename\nlinecount\nll\nllapp\nllbin\nllbranch\nllcommit1\nlld\nllpaths\nllpathst\nllps\nllrecent\nllsize\nllsortlast\nlltar\nlltime\nlltree\nlltype\nllunpaths\nlocate-update\nlog-grep\nlowercase\nls\nls1\nlsdisk\nlsn\nlsusb\nltrim\nlwrap\nmacbook-config-sleep-hibernate\nmacbook-config-sleep-normal\nmaclife.d\nmake-with\nmatch\nmatchfiles\nmath\nmdtool\nmerge\nmergefiles\nmergepython\nmergeruby\nmkalias\nmkalias2\nmkbash\nmkbin\nmkbranch\nmkbranch-local\nmkcd\nmkmod\nmkpy\nmkpy-basic\nmonth2num\nmvbin\nmvbranch\nmvim\nmvimc\nmvimft\nmvims\nmysql-start\nmysql-stop\nnarrow\nnatsort\nnbytes\nnetinfo-arp\nnetinfo-arp-scan\nnetinfo-daemons\nnetinfo-netdiscover\nnetinfo-netstat\nnetinfo-netstat-tulpn\nnetinfo-nmap-scan-localnet\nnetinfo-pingsweep\nnetinfo-routes\nnetpen-fetch\nnetpen-find-interesting-files\nnetpen-getinfo\nnetpen-getinfo2\nnetpen-getinfo3\nnetpen-outdir\nnetpen-path\nnetscan\nnetview\nnewl\nnlines\nnocolor\nnormpath\nnpm-download-all-packages\nnthcol\nnthline\nnull\noauth\nopencl-linklib\nopen-editor\nopenfirst\nopenvpn-fetch-client-files\nosx-bouncing-icons-disable\nosx-bouncing-icons-enable\nosx-cpu-features\np'\npackhex\nparse-c\npastebin\npatch-apply\npatch-create\npatch-integrate\npdfcat\nphoenix-db-setup\nphoenix-deps\nphoenix-new\nphoenix-start\npingsweep\npip-install-test\nplistcat\nplt-racket\nportscan\nportscan2\nportscan3\nportscan-quick\npos\npostgres-initialize-database\npostgres-start\npostgres-stop\npq\nprint0\nprjson\npsfind\nps-find\npsfocus\npskill\nps-offspring\npsqlgetfield\npsqlsetfield\nptyfix\npubkey\npwgen\npws\npy-example-watchdog\npyinst\npypitest-register\npypitest-upload\npython-build-ext\npyval\nquote\nquoten\nquotent\nramdisk-create\nrand-bday\nrandint\nratio\nre\nre[\nre[]+\nreadvar\nrecgrep\nrecvchars\nrecvfile\nrecvsh\nrecvtar\nredis-start\nreminder\nrename\nreplace\nreplace2\nreplace-in-files\nreplace_n_rn\nreport-gen\nresub\nrevbytes\nreverse\nrevlines\nrevstr\nrgrep\nrll\nrls\nrmblanks\nrmbranch\nrmbranch-remote\nrmrf\nrouteof\nroutes\nrpi-default-led\nrpi-deploy\nrtrim\nrun\nsack\nsackvim\nsag\nscrap-setup-ubuntu\nscreenshot-firefox\nsdcard-dd\nsdcard-detect-disk\nsdcard-write-freebsd\nsdcard-write-kali\nsendbackup\nsendchars\nsendfile\nsendsh\nsendsh2\nsendtar\nsendweb\nsha1sum-recursive\nsha256sums\nsimulavr_preprocess\nskip-first-n-lines\nskip-last-n-lines\nskip-n-lines\nsleepnow\nsnippet-array-loop-with-spaces\nsnippet-receive-and-repass-quoted-args\nsnippet-receive-and-repass-quoted-args2\nsnippet-special-params\nsocatchk\nsort-cppfiles\nsortuniq\nsplitby\nsplitext\nsp-notes\nspotlight-rebuild\nsqlmap\nsrm1\nsrm1z\nsrmz\nsshfwd\nsshproxy\nssh-rpi\nssh-sync\nsshtar\nstrace-osx\nsub\nsub1\nsuball\nsub-all\ntcpview\ntd\ntmpbin\ntohex\ntrim\ntrimlines\ntsnap\nttyMSP\ntweets\nudisk\nunbuffer\nunescape\nunix2dos\nunquote\nurlavail\nurldecode\nurlencode\nurlquote\nurlunquote\nutcnow\nutcstamp\nutcstamp2time\nutctime2stamp\nviewbytes\nviewchars\nviewfile\nvimterm\nvim-tokenize\nvinoinfo\nvs\nwatcher\nwgetfiles\nwhere\nwheredir\nwhichapp\nxbuild-both\nxbuild-debug\nxbuild-release\nzopped\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshawwn%2Fscrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshawwn%2Fscrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshawwn%2Fscrap/lists"}