Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
#include <fstream>
#include <vector>
#include <boost/algorithm/string.hpp>
using namespace std;
void usage()
{
cout << "Usage: cvstoss file.csv" << endl;
@Shudouken
Shudouken / blackjack.py
Created September 2, 2014 19:56
Blackjack
import random
showRemainingCards = True
def card(num):
if num == 1:
card = 'A'
if num >= 2 and num <= 10:
card = str(num)
if num == 11:
@Shudouken
Shudouken / convert_script.lua
Last active August 29, 2015 14:12
Convert Script - ffmpeg edition
-- README:
-- original version by Zehkul https://gist.github.com/Zehkul/25ea7ae77b30af959be0
-- needs: yad, libnotify, imagemagick (and ytdl if you want to encode streams)
-- press any of alt + w, g, x or c to set the start frame
-- press again to set the end frame and use
-- alt + w to make a webm
-- alt + g to make a gif
-- alt + x to make a x264 encoded mkv
-- alt + c to make a direct stream copy saved into mkv (fast but start time may be off due to keyframes)
-- alt + 5 to make a experimental x265 encoded mkv
@Shudouken
Shudouken / terminal-dl.lua
Created January 28, 2015 06:20
terminal-dl.lua
-- README:
-- calls terminal and starts youtube-dl to download the video currently playing
local opt = require 'mp.options'
-- default options, .conf is read
local options = {
terminal = 'guake -t && guake -n guake -e',
--terminal = 'gnome-terminal -e',
--terminal = 'konsole -e'
@Shudouken
Shudouken / history.lua
Last active August 29, 2015 14:15
history.lua
--logs filename and timeposition to a history file when closing mpv
--needs wc for word counting
local msg = require 'mp.msg'
-- default options, .conf is read
local options = {
history_file = os.getenv("HOME") .. "/.mpv/history",
line_limit = 20, --set to 0 for unlimited history logging
--by default it will log the last 20 files
}
@Shudouken
Shudouken / bootstick.sh
Last active August 29, 2015 14:17
Creates a bootstick from archlinux based iso
#creates a bootstick from archlinux based iso
function usage() {
echo "usage $0 /path/to/your_arch.iso /dev/sdX1"
echo "example: $0 archlinux-2015.02.01-dual.iso /dev/sdb1"
echo ""
echo "/dev/sdX needs to have an ms-dos partition table"
exit 1
}
@Shudouken
Shudouken / youtube-starttime.lua
Last active August 29, 2015 14:17
youtube-starttime.lua
--sets the startime of a youtube video as specified in the "t=HHhMMmSSs" part of the url
local msg = require 'mp.msg'
function youtube_starttime()
url = mp.get_property("path", "")
start = 0
if string.find(url, "youtu%.?be") and
((url:find("http://") == 1) or (url:find("https://") == 1)) then
local on = false
function slideshow_handler()
if on == false then
mp.osd_message("Starting slideshow")
on = true
mp.command("playlist_next")
if sl_timer then
sl_timer:resume()
src
-- Simple hook that converts .bpg files as you open them with mpv
-- libbpg needs to be installed on your system
-- You can specify the output format (.ppm or .png) but conversion
-- to .png is slower. You can also increase the bit depth for .png
-- by passing "-b 16" and it supports transparency.
-- It seems animated files are not yet supported by bpgdec.
local msg = require 'mp.msg'