Skip to content

Instantly share code, notes, and snippets.

@atomotic
atomotic / readme.md
Created April 13, 2017 15:21
chrome headless: capture har and replay with webrecorderplayer
  1. install chrome-har-capture

     ~ npm install -g chrome-har-capturer
    
  2. install Chrome Canary

     ~ /Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --remote-debugging-port=9222 --headless
    
  3. capture har

➜ ~ /Applications/webrecorderplayer-electron.app/Contents/Resources/app/python-binaries/webrecorder {file.warc}
# https://github.com/internetarchive/warctools
~ warcfilter -H video/mp4 original.warc.gz > video.warc
# https://github.com/chfoo/warcat
~ python3 -m warcat extract video.warc --output-dir ./videos --progress
(venv) ➜ twarc git:(master) ✗ pyinstaller --clean --hidden-import urllib3 --hidden-import queue --onefile twarc.py
(venv) ➜ twarc git:(master) ✗ ls -lah dist/twarc
-rwxr-xr-x 1 raffaele 5.4M Jan 4 21:01 dist/twarc
(venv) ➜ twarc git:(master) ✗ file dist/twarc
dist/twarc: Mach-O 64-bit executable x86_64
./dist/twarc --help
usage: twarc [-h] [--log LOG] [--consumer_key CONSUMER_KEY]
package EPrints::Plugin::Export::DEPOSITOLEGALE;
# eprint needs magic documents field
# documents needs magic files field
use EPrints::Plugin::Export::XMLFile;
@ISA = ( "EPrints::Plugin::Export::DIDL" );
@atomotic
atomotic / .zshrc
Last active February 21, 2018 10:45
check if Software Heritage archive contains your code
function swh-check() { curl -s --data "q=$(sha1sum $* | cut -d " " -f 1)" https://archive.softwareheritage.org/api/1/content/known/search/ | jq . }
~ mediawiki=$(curl -s https://raw.githubusercontent.com/wikimedia/mediawiki/master/index.php | gsha1sum | cut -d " " -f 1)

~ curl -s --data "q=$mediawiki" https://archive.softwareheritage.org/api/1/search/ | jq .
{
  "search_stats": {
    "nbfiles": 1,
    "pct": 100

},

➜ Downloads unzip -l extension_0_0_129.crx
Archive: extension_0_0_129.crx
warning [extension_0_0_129.crx]: 566 extra bytes at beginning or within zipfile
(attempting to process anyway)
Length Date Time Name
-------- ---- ---- ----
0 05-13-16 22:41 icons/
7952 05-13-16 22:41 icons/icon128.png
759 05-13-16 22:41 icons/icon16.png
2858 05-13-16 22:41 icons/icon48.png
@atomotic
atomotic / wget-lua.sh
Created May 3, 2016 09:28
install wget-lua on osx
brew install lua5.1
curl http://warriorhq.archiveteam.org/downloads/wget-lua/wget-1.14.lua.LATEST.tar.bz2 | tar -xj --strip-components=1
sed -i -e s=usr/include/lua5.1=usr/local/include/lua5.1=g configure.ac
./configure
make
cp src/wget /usr/local/bin/wget-lua
wget-lua --help|grep lua
GNU Wget 1.14.lua.20130523-9a5c, a non-interactive network retriever.
Usage: wget-lua [OPTION]... [URL]...
@atomotic
atomotic / # scantailor - 2015-12-04_21-22-47.txt
Created December 4, 2015 20:26
scantailor (homebrew/x11/scantailor) on OS X 10.11.1 - Homebrew build logs
Homebrew build logs for homebrew/x11/scantailor on OS X 10.11.1
Build date: 2015-12-04 21:22:47