| coerce to > | real (double) | int (long) | byte (uchar) | bool (uchar) | string (sprintf) |
|---|---|---|---|---|---|
| real (double) | IEEE | 0xFF mask of int | 0x01 mask of int | %g | |
| int (long) | IEEE | 0xFF mask | 0x01 mask | %ld | |
| byte (uchar) | from int | sign smear | 0x01 mask | %c | |
| bool (uchar) | 0.0 or 1.0 | 0 or 1 | 0x00 or 0x01 | "0" or "1" | |
| string (sscanf) | %g | %ld | %c | not "" or "0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // developer console will mess with this (window.innerHeight). close it. | |
| $(function(){ | |
| $('video').on('ended',function(){ | |
| // reload thumbnail | |
| this.autoplay = false; | |
| this.load(); | |
| }).on('click',function(){ | |
| // if no double click, change play state | |
| var innerHeight = window.innerHeight; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # sets a video's encode date by using the file's mtime | |
| # requires mediainfo and ffmpeg | |
| # see also the inverse of this script: "mtime-from-encode-date.sh" | |
| # https://gist.github.com/yoosefi/3d5841e0c2b71edf02eec0730249128f | |
| set -eu | |
| for each in "$@"; do | |
| x=($(mediainfo "${each}" | grep 'Encoded date')) | |
| # only remux if the date is bogus | |
| if [[ "${x}" == "" || "${x[4]}" =~ ^19[0-8].* ]]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # sets video file mtime to its encode date | |
| # requires mediainfo | |
| # see also the inverse of this script: "encode-date-from-mtime.sh" | |
| # https://gist.github.com/yoosefi/66d9a58466fb9e8bf5a8467fc11f470e | |
| set -eu | |
| for each in "$@"; do | |
| x=($(mediainfo "${each}" | grep -m1 'Encoded date')) | |
| # skip null dates | |
| if [ -z "${x}" ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # nemo script to convert a video to a gif, scaling to a variable width. | |
| # put this in ~/.local/share/nemo/scripts/ | |
| # requires zenity, ffmpeg, and gifsicle | |
| set -eu | |
| WIDTH=$(zenity --entry --title="Enter GIF Width" --text="Enter the desired GIF width. -1 means the same width as the source video:\n${1}" --entry-text="-1") | |
| SCALE="scale=${WIDTH}:-1:flags=lanczos" | |
| ffmpeg -i "${1}" -vf "${SCALE},palettegen=stats_mode=diff" -y /tmp/palette.png | |
| ffmpeg -i "${1}" -i /tmp/palette.png -lavfi "${SCALE} [x]; [x][1:v] paletteuse=dither=bayer:bayer_scale=5:diff_mode=rectangle" -y /tmp/tmp.gif | |
| BASENAME=$(basename "${1}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var request = require('request'); | |
| module['exports'] = function SwearJar (hook) { | |
| var jar = ''; | |
| request | |
| .get('https://github.com/'+hook.params.repo+'/raw/'+hook.params.branch+'/'+hook.params.jar) | |
| .on('response',function(res){ | |
| hook.debug(res); | |
| res | |
| .on('data',function(chunk){ |
I hereby claim:
- I am yoosefi on github.
- I am yoosefi (https://keybase.io/yoosefi) on keybase.
- I have a public key whose fingerprint is 7D0A C5B5 A420 0DA0 1364 5654 CC53 7A28 B66D 6176
To claim this, I am signing this object:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python2 | |
| # MAKE SURE TRANSMISSION IS CLOSED FIRST, DUH | |
| # | |
| # this file works by iterating every file in the current directory (which should be the "resume" directory!), | |
| # scanning them for the old path and updating the serialized data with the new path if found | |
| # | |
| # if you have renamed a drive or massively moved things around and want to rename a part of the destination path | |
| # without having to hand-pick those torrents through the gui to move their associated destinations | |
| # you can run this in your transmission "resume" directory. | |
| # the directory is usually at ~/.config/transmission/resume |
NewerOlder