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 / usbreset.py
Last active August 29, 2015 14:23
send a USB port reset to a USB device
#!/usr/bin/env python
# usbreset -- send a USB port reset to a USB device
#
# http://askubuntu.com/questions/645#answer-661
#
# $ sudo usbreset.py DUB
# Looking for device: DUB
# Executing command: `lsusb | grep DUB`
# Subprocess: b'Bus 001 Device 006: ID 2001:1a02 D-Link Corp. DUB-E100 Fast...'
# Found device 001 on bus 006 for "D-Link Corp. DUB-E100 Fast Ethernet Adapt..."
@stav
stav / ScrapyLog.YAML-tmLanguage
Created August 13, 2015 19:19
Syntax Definition file for Scrapy log files
# [PackageDev] target_format: plist, ext: tmLanguage
---
name: Scrapy Log
scopeName: source.slog
fileTypes: [slog]
uuid: 030ae93f-5fcf-4bbd-8caa-81fcdcf77ec3
patterns:
- comment: date-time [logger] level
@stav
stav / RouteSpider.py
Created August 14, 2015 19:56
Scrapy route spider pseudo code
class MySpider(RouteSpider):
name = "example.com"
def start_routes(self, response):
for city in response.css('#location .dropdown-bg li'):
yield Route(
url=city.xpath('a/@href'),
callback=self.parse_city,
@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 / clean
Created May 15, 2016 21:55
Remove Python bytecodes and deployment cache
#!/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";
@stav
stav / find
Created May 15, 2016 21:56
Find files using a shorter syntax: `f .jpg`
#!/bin/bash
if [ `expr index "$1" "\+"` = 0 ]; then
PATTERN="*$1*"
else
#PATTERN="$1"
PATTERN="${1/+/*}"
fi
if [ -n "$2" ]; then
@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
@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.
#
#
mpv --input-test --force-window --idle
mpv --input-keylist
mpv --list-options
Keyboard
r and t
Move subtitles up/down
@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