Skip to content

Instantly share code, notes, and snippets.

@snakebird
snakebird / gist:b23d3b2af1e7fe93ce7070293155cf67
Created November 15, 2021 15:53
.inset-center for Tailwind
.inset-center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
@snakebird
snakebird / README.md
Created February 17, 2021 13:05 — forked from laserbat/README.md

To use this script

  1. Install xdotool: $ sudo apt install xdotool

  2. Install this script to /usr/local/bin: $ sudo cp path/to/file/permafocus.sh /usr/local/bin/ (path/to/file should be replaced by the actual path to the folder containing script, for example ~/Downloads/)

@snakebird
snakebird / in_viewport.js
Created August 27, 2020 13:48 — forked from jjmu15/in_viewport.js
check if element is in viewport - vanilla JS. Use by adding a “scroll” event listener to the window and then calling isInViewport().
// Determine if an element is in the visible viewport
function isInViewport(element) {
var rect = element.getBoundingClientRect();
var html = document.documentElement;
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || html.clientHeight) &&
rect.right <= (window.innerWidth || html.clientWidth)
);
@snakebird
snakebird / corsproxy.php
Created January 24, 2019 12:39 — forked from dropmeaword/corsproxy.php
simple CORS proxy in php
<?php
error_reporting( error_reporting() & ~E_NOTICE ); // evil
// config
$enable_jsonp = false;
$enable_native = false;
$valid_url_regex = '/.*/';
// ############################################################################
@snakebird
snakebird / eslintrc.js
Created October 22, 2017 20:15
ESlint cfg
module.exports = {
"env": {
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module"
},
"rules": {
@snakebird
snakebird / gist:1ef6b672a958a5a9f03e8ec9716d751d
Created October 20, 2017 20:35
youtube-dl external downloader
youtube-dl-aria is obsolete - youtube-dl added builtin support for external
downloaders early 2015.
If you want to duplicate the behaviour of youtube-dl-aria using just
youtube-dl, you can run:
mkdir -p ~/.config/youtube-dl/
cat > ~/.config/youtube-dl/config <<EOF
-o "[%(upload_date)s][%(id)s] %(title)s (by %(uploader)s).%(ext)s"
--external-downloader aria2c
@snakebird
snakebird / VAAPI-hwaccel-encode-Linux-Ffmpeg&Libav-setup.md
Created May 5, 2017 21:06 — forked from Brainiarc7/VAAPI-hwaccel-encode-Linux-Ffmpeg&Libav-setup.md
This gist contains instructions on setting up FFmpeg and Libav to use VAAPI-based hardware accelerated encoding (on supported platforms) for H.264 (and H.265 on supported hardware) video formats.

Using VAAPI's hardware accelerated video encoding on Linux with Intel's hardware on FFmpeg and libav

Hello, brethren :-)

As it turns out, the current version of FFmpeg (version 3.1 released earlier today) and libav (master branch) supports full H.264 and HEVC encode in VAAPI on supported hardware that works reliably well to be termed "production-ready".

@snakebird
snakebird / kodi1.md
Last active May 16, 2016 18:41
Zmiana wyjścia audio za pomocą YATSE

Sprawdzenie aktualnego ustawienia:

curl -v -H "Content-type: application/json" -d '{"jsonrpc":"2.0","method":"Settings.GetSettingValue", "params":{"setting":"audiooutput.audiodevice"},"id":1}' http://KODI_HOST/jsonrpc

Przykładowe rezultaty w przypadku OpenElec (dla HDMI i BT Audio):

{"id":1,"jsonrpc":"2.0","result":{"value":"PI:HDMI"}}
{"id":1,"jsonrpc":"2.0","result":{"value":"PULSE:Default"}}
@snakebird
snakebird / command.txt
Last active August 29, 2015 14:15 — forked from nrk/command.txt
ffprobe in json
ffprobe -v quiet -print_format json -show_format -show_streams "lolwut.mp4" > "lolwut.mp4.json"
<?php
$docs = $modx->getCollection('modDocument');
$pattern = '/www.xxx.com/(\d+)/';
$replacement = '[[~$1]]';
$count = 0;
foreach ($docs as $doc) {
$content = $doc->getContent();
$hash1 = sha1($content);