Skip to content

Instantly share code, notes, and snippets.

View livibetter's full-sized avatar

Yu-Jie Lin livibetter

View GitHub Profile
@livibetter
livibetter / No_Vodcasts.user.js
Last active September 25, 2017 15:25
Twitch: No Vodcasts
// ==UserScript==
// @name No Vodcasts
// @namespace https://gist.github.com/livibetter/e3a599a540db40ce2a3691bc74208dbc
// @include https://www.twitch.tv/directory/*
// @version 1
// @grant none
// ==/UserScript==
function check_stream(stream)

All the files in this repository are licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

You might also want to check out the scripts.

@livibetter
livibetter / COPYING
Last active August 1, 2019 23:11
extract-xml.py
Copyright (c) 2017 Yu-Jie Lin
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@livibetter
livibetter / sed-delimiter.sh
Created July 15, 2017 13:53
sed delimiter
#!/bin/bash
# https://www.reddit.com/r/commandline/comments/6nb76h/lpt_use_hashpoundnumbersignoctothorpe_as_a_sed/dk8hanv/
DICT=/usr/share/dict/words
main()
{
SALL=($(egrep '^s(\w).*\1.*\1$' "$DICT"))
@livibetter
livibetter / ax.xaxis.py
Created July 14, 2017 03:48
show test scripts for animated figures with blit, imshow, axis and text in Matplotlib
#!/usr/bin/env python3
import matplotlib.animation as animation
import matplotlib.pyplot as plt
import numpy as np
# https://stackoverflow.com/a/30860027/242583
# patch for ax.xaxis
# 1. ax.xaxis.set_animated(True)
# 2. add ax.xaxis to the returning list of update function
@livibetter
livibetter / benchmark.py
Created July 4, 2017 06:30
element-wise addition on two lists
#!/usr/bin/env python3
from timeit import timeit
NUMBER = 1000
ELEMENTS = 10000
SETUP = 'N = {}; X = list(range(N)); Y = list(range(N))'.format(ELEMENTS)
SETUP_NP = 'N = {}; import numpy as np; X = np.arange(N); Y = np.arange(N)'.format(ELEMENTS)
STATS = [
@livibetter
livibetter / README
Last active May 1, 2019 01:34
pings
$ ping -i 10 -D 168.95.1.1 |
sed -un '/\[/ s/\[\([0-9]\+\).* time=\([0-9.]\+\).*/\1 \2/p' |
tee ping-168.95.1.1
$ ping -i 10 -D 168.95.98.254 |
sed -un '/\[/ s/\[\([0-9]\+\).* time=\([0-9.]\+\).*/\1 \2/p' |
tee ping-168.95.98.254
$ ./ping.gnu && sxiv ping-168.95.png
@livibetter
livibetter / UNLICENSE
Last active November 26, 2016 02:42
cheating in the Battle for Wesnoth
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@livibetter
livibetter / MOVED
Last active January 15, 2017 07:30
gh-watch.py watches for GitHub projects
gh-watch.py [1] has been moved to GitHub.
[1] https://github.com/livibetter/gh-watch.py
@livibetter
livibetter / streaming
Created May 1, 2016 01:05
streaming script for Twitch and YouTube
#!/bin/bash
# Written by Yu-Jie Lin in 2016
# Adopted from
# https://wiki.archlinux.org/index.php/Streaming_using_twitch.tv
# With guides
# http://help.twitch.tv/customer/portal/articles/1253460-broadcast-requirements
# https://trac.ffmpeg.org/wiki/StreamingGuide
# https://support.google.com/youtube/answer/2853702
LOG_OPTS='-loglevel warning -stats'