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 / 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
*/
@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
{
"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 / 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
@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 / index.html
Created September 30, 2017 21:40
Vuetify.js
<div id="app">
<v-app>
<v-navigation-drawer
persistent
:mini-variant="miniVariant"
:clipped="clipped"
v-model="drawer"
>
<v-list>
<v-list-item
@stav
stav / sitemap_generator_pipeline.py
Last active December 9, 2016 16:05
Scrapy sitemap generator pipeline
""" pipelines.py """
import collections
import scrapy
import scrapy.contrib.exporter
import myproject
class SitemapPipeline(object):
"""
Sitemap builder
@stav
stav / usbreset.c
Created May 15, 2016 21:46
Send a USB port reset to a USB device
/*
usbreset -- send a USB port reset to a USB device
http://askubuntu.com/questions/645#answer-661
cc usbreset.c -o usbreset
lsusb |grep DUB
Bus 001 Device 021: ID 2001:1a02 D-Link Corp. DUB-E100 Fast Ethernet Adapter(rev.C1) [ASIX AX88772]
@stav
stav / mpv.conf
Last active July 21, 2016 03:52
mpv configuration file
#
# Example mpv configuration file
#
# Warning:
#
# The commented example options usually do _not_ set the default values. Call
# mpv with --list-options to see the default values for most options. There is
# no builtin or example mpv.conf with all the defaults.
#
#
@stav
stav / input.conf
Last active July 21, 2016 03:52
mpv keybindings
# mpv keybindings
#
# Location of user-defined bindings: ~/.config/mpv/input.conf
#
# Lines starting with # are comments. Use SHARP to assign the # key.
# Copy this file and uncomment and edit the bindings you want to change.
#
# List of commands and further details: DOCS/man/input.rst
# List of special keys: --input-keylist
# Keybindings testing mode: mpv --input-test --force-window --idle