Skip to content

Instantly share code, notes, and snippets.

@guixxx
guixxx / lrc-autoload.lua
Last active December 1, 2019 22:22
(DEPRECATED) Automatically loads lyric (.lrc) files to mpv if they're found
-- NOTE: This script is no longer necessary as of mpv 0.30.0!
loaded = false
function search_and_load_lrc()
local lrc_path = ext2lrc(mp.get_property("path"))
local file = io.open(lrc_path, "r")
if file ~= nil then
io.close(file)
local sense=-20
local speed = mp.get_property("speed")
local detect = false
function f(msg)
if string.find(msg.text, "silence_end") and detect then
mp.set_property("speed",speed)
endmsg=msg.text
detect = false
--print("end")
elseif string.find(msg.text, "silence_start") and detect==false then
@christophemarois
christophemarois / imslp.user.js
Last active April 2, 2020 17:03
Bypass waiting on IMSLP
// ==UserScript==
// @name IMSLP wait bypasser
// @version 0.1
// @description Bypass waiting on IMSLP
// @author @christophemarois
// @match http://imslp.org/*
// @match https://imslp.org/*
// ==/UserScript==
(function(){
@pwlin
pwlin / gist:8a0d01e6428b7a96e2eb
Last active May 6, 2024 10:50
Android : add cert to system store
https://code.google.com/p/android/issues/detail?id=32696#c5
If you have a certificate that is not
trusted by Android, when you add it, it goes in the personal cert store.
When you add a cert in this personal cert store, the system requires a
higher security level to unlock the device. But if you manage to add your
cert to the system store then you don't have this requirement. Obviously,
root is required to add a certificate to the system store, but it is quiet
easy.
@csssuf
csssuf / bar.sh
Last active April 19, 2023 10:52
Adds now playing indicator from spotify or MPD to i3status
#!/bin/bash
i3status | while :
do
read line
dir=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
spotify_status=$(dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus' | tail -n1 | cut -d'"' -f2)
spotify_artist=$(dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' | awk -f ${dir}/spotify_song.awk | head -n 1 | cut -d':' -f2)
spotify_song=$(dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' | awk -f ${dir}/spotify_song.awk | tail -n 1 | cut -d':' -f2)

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r
@preetum
preetum / z3color.py
Created January 23, 2014 01:53
Determines the chromatic number of graphs (and their coloring), using Microsoft's Z3 SMT solver.
## This script uses Microsoft's Z3 SMT solver
## to determine the chromatic number (and corresponding coloring) of graphs.
##
## Author: Preetum Nakkiran, 2014
from z3 import *
def color(V, E, k):
"""
Attempt to color the graph G(V, E) with k colors
@willurd
willurd / web-servers.md
Last active May 28, 2024 06:57
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000