Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
c0d1ng

Steven Almeroth stav

💭
c0d1ng
View GitHub Profile
@stav
stav / priceCandles.ts
Last active Apr 13, 2022
Candles prices horizontal
View priceCandles.ts
// 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
View Petstore-1.0.0-swagger.json
{
"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 Jan 10, 2019
Sublime Text Syntax Definition for Scrapy log files
View ScrapyLog.sublime-syntax
%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 Nov 27, 2018
Querystring prettification
View qs
#!/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).
View index.html
<div id="app">
<v-app>
<v-navigation-drawer
persistent
:mini-variant="miniVariant"
:clipped="clipped"
v-model="drawer"
>
<v-list>
<v-list-item
View gist:2ff53165b927613bd7983a1c20f2c70d
mpv --input-test --force-window --idle
mpv --input-keylist
mpv --list-options
Keyboard
r and t
Move subtitles up/down
@stav
stav / mpv.conf
Last active Jul 21, 2016
mpv configuration file
View mpv.conf
#
# 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 Jul 21, 2016
mpv keybindings
View input.conf
# 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
@stav
stav / find
Created May 15, 2016
Find files using a shorter syntax: `f .jpg`
View find
#!/bin/bash
if [ `expr index "$1" "\+"` = 0 ]; then
PATTERN="*$1*"
else
#PATTERN="$1"
PATTERN="${1/+/*}"
fi
if [ -n "$2" ]; then
@stav
stav / clean
Created May 15, 2016
Remove Python bytecodes and deployment cache
View clean
#!/bin/bash
if [ -n "$1" ]; then
TARGET="$1"
else
TARGET="."
fi
# Remove Python compiled bytecode files
command="find $TARGET -name '*.pyc' -type f -delete -print 2>/dev/null";