Skip to content

Instantly share code, notes, and snippets.

View stav's full-sized avatar
💭
c0d1ng

Steven Almeroth stav

💭
c0d1ng
View GitHub Profile
@stav
stav / qs
Created November 27, 2018 20:11
Querystring prettification
#!/bin/sh
IFS=$'\n' # Allow spaces and other white spaces.
stty -icanon # Disable canonical mode.
stty eof ^D
python3 ~/bin/qs.py
stty icanon # Re-enable canonical mode (assuming it was enabled to begin with).
@stav
stav / ScrapyLog.sublime-syntax
Created January 10, 2019 23:17
Sublime Text Syntax Definition for Scrapy log files
%YAML 1.2
---
# See http://www.sublimetext.com/docs/3/syntax.html
# See http://www.sublimetext.com/docs/3/scope_naming.html
#
# Note that blackslashes don't need to be escaped within single quoted strings
# in YAML. When using single quoted strings, only single quotes need to be
# escaped: this is done by using two single quotes next to each other.
#
# Scope discovery - Ctrl Shft Alt p
{
"swagger" : "2.0",
"info" : {
"description" : "This is a sample Petstore server. You can find \nout more about Swagger at \n[http://swagger.io](http://swagger.io) or on \n[irc.freenode.net, #swagger](http://swagger.io/irc/).\n",
"version" : "1.0.0",
"title" : "Swagger Petstore",
"termsOfService" : "http://swagger.io/terms/",
"contact" : {
"email" : "apiteam@swagger.io"
},
@stav
stav / priceCandles.ts
Last active April 13, 2022 18:53
Candles prices horizontal
// If you run this in Deno:
priceCandles (prices: PriceBars) {
// Function scope finals
const bars = prices.PriceBars
const lows = bars.map(bar => bar.Low)
const highs = bars.map(bar => bar.High)
const high = Math.max(...highs)
const low = Math.min(...lows)
const diff = high - low
@stav
stav / filesave.js
Created April 6, 2024 14:39
Scrape Script - Save browser document contents to local file
;(async () => {
/**
* Save the content of the current page to a file.
*
* (Currently only works in Chrome)
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/showSaveFilePicker
* @param {string} name
* @param {string} content
*/