Skip to content

Instantly share code, notes, and snippets.

@rergw
rergw / escrow.rb
Created September 12, 2018 04:31
escrow api
classes = %i(Escrows Escrow)
classes.each do |klass|
Object.send(:remove_const, klass) if Object.constants.include?(klass)
end
escrow_attrs = %i(seller_address buyer_address optional_arbitrer
optional_product)
Escrow = Struct.new(*escrow_attrs) do
@rergw
rergw / scraper.js
Last active September 15, 2018 15:14
General purpose scraper adapted to angel.co
/*
General purpose scraper adapted to angel.co.
Does not support pagination.
Usage:
1. For other pages change `map` and `item`.
2. Copy entire code into browser console
3. Results are copied to clipboard and can be pasted on a spreadsheet.
@rergw
rergw / cat_txt_to_spreadsheet.rb
Created September 17, 2018 13:49
Converts categorized text into text for spreadsheets. Copies results to clipboard.
=begin
Converts categorized text into text for spreadsheets.
Copies results to clipboard.
Converts:
```
cat 1
entry 1

Import/Export for Scraper Chrome Extension

These files are a way to import and export fields entered in Chrome Scraper extension:

https://chrome.google.com/webstore/detail/scraper/mbigbapnjcgaffohmbkdlecaccepngjd?hl=en

Even when Presets option allows to save all fields, it is not apparent how to share presets between different installations, this is then a very rough attempt.

After exploring local storage for extension I saw that presets are stored there, so they can be copied and merged as a JSON would be merged:

@rergw
rergw / angel_co_scraper.js
Last active March 5, 2019 17:37
General purpose scraper adapted to angel.co.
/*
General purpose scraper adapted to angel.co.
Does not support pagination.
Usage:
1. For other pages change `map` and `item`.
2. Copy entire code into browser console
3. Results are copied to clipboard and can be pasted on a spreadsheet.
C:\Users\pasta\AppData\Local\Android\Sdk\platform-tools\adb.exe forward tcp:9222 localabstract:chrome_devtools_remote
wget -O tabs.json http://localhost:9222/json/list
REM ruby -e "require 'json'; puts JSON.load(File.read('tabs.json')).map{|e| %W{<a href='#{e['url']}'> #{e['title']}</a><br/>} }" | Set-Clipboard -AsHtml
ruby -e "require 'json'; puts JSON.load(File.read('tabs.json')).map{|e| %W{#{e['title']}\t#{e['url']}} }" | Set-Clipboard
python fast_video.py ~/Downloads/2020_01_17_14_43_49.mp4 2
ffmpeg version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --ena
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/meme/.meteor/packages/meteor-tool/.1.10.2.121ry7f.gueme++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:311:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 5.3.0-42-generic
gyp ERR! command "/home/meme/.meteor/packages/meteor-tool/.1.10.2.121ry7f.gueme++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/node" "/home/meme/.meteor/packages/meteor-tool/.1.10.2.121ry7f.gueme++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/meme/code/dtube/node_modules/bufferutil
gyp ERR! node -v v12.16.1
gyp ERR! n