Skip to content

Instantly share code, notes, and snippets.

@TiGR
TiGR / install-kffmpegthumbnailer.sh
Created September 25, 2021 18:06
Build and install kffmpegthumbnailer
#!/bin/bash
cd /tmp
wget https://github.com/dirkvdb/ffmpegthumbnailer/archive/master.zip -c
unzip master.zip
cd ffmpegthumbnailer-master/
sudo apt purge -y ffmpegthumbnailer ffmpegthumbs
sudo apt install -y cmake pkg-config extra-cmake-modules libavcodec-dev libavformat-dev libavutil-dev libavfilter-dev libkf5kio-dev libkf5config-dev libkf5i18n-dev gettext
cmake . -DCMAKE_INSTALL_PREFIX=/usr/
make
@TiGR
TiGR / post-install.sh
Last active August 29, 2015 14:14
Ubuntu 14.04 post-install script
#!/bin/bash
# language
apt-get install -y language-pack-ru aptitude
echo "LANG=\"ru_RU.UTF-8\"
LC_ALL=\"ru_RU.UTF-8\"" > /etc/default/locale
# timezone
echo "Europe/Moscow" > /etc/timezone
dpkg-reconfigure -f noninteractive tzdata
@TiGR
TiGR / htpassgen.sh
Last active August 22, 2016 18:18
htpasswd entries generator.
#!/bin/bash
read -p 'Username: ' name && read -s -p 'Password: ' pass && (>&2 echo) && echo "$name:$(openssl passwd -apr1 $pass)"
@TiGR
TiGR / removeoldkernels.sh
Last active December 4, 2015 08:11
Script to remove old kernels
#!/bin/sh
# IMPORTANT: in order for this script to work as expected you need to make sure that
# kernel metapackage (such as linux-image-generic or linux-image-lts-* is installed).
# Also, since this script uses apt-get autoremove, make sure that it won't remove any
# of packages you need.
#
# How it works: it just marks all kernel packages (except packages for current kernel)
# as automatically installed, that is, available for autoremove. Then it does the
# autoremove.
@TiGR
TiGR / hamster-stop-on-screensaver.sh
Last active August 29, 2015 14:06
Integrate hamster-applet into KDE (stop tracking on screensaver)
#!/bin/bash
# this script makes hamster stop tracking once screensaver is started. Just like in gnome.
# just add this script to kde session autostart programs
# source: https://gist.github.com/TiGR/4454205f4516e665312a
dbus-monitor type='signal',interface='org.freedesktop.ScreenSaver',member='ActiveChanged',path='/org/freedesktop/ScreenSaver' | grep true --line-buffered |
while read line; do
@TiGR
TiGR / Example.php
Last active April 3, 2019 09:41
Just an example how you could strip spaces before all (well, almost) control structures. See: https://github.com/TiGR/twig-preprocessor
<?php
$loader = new Twig_Loader_Preprocessor(new Twig_Loader_Filesystem('tpl'),
function ($template) {
static $regExp;
// the RE isn't perfect, it won't match structures having curly braces within,
// but it's okay for me.
if (!isset($regExp)) {
$regExp = str_replace(
['_', '{', '}'],
@TiGR
TiGR / jw_downloader.py
Last active August 28, 2019 15:52
JW.org media files downloader
#!/usr/bin/python3
feedURLs = ['http://www.jw.org/apps/U_sFFZRQVNZNT?rln=U&rmn=g&rfm=m4b',
'http://www.jw.org/apps/U_sFFZRQVNZNT?rln=U&rmn=w&rfm=m4b',
'http://www.jw.org/apps/U_sFFZRQVNZNT?rln=U&rmn=wp&rfm=m4b',
'http://www.jw.org/apps/U_sFFCsVrGZNT?rln=U&rmn=g&rfm=pdf',
'http://www.jw.org/apps/U_sFFCsVrGZNT?rln=U&rmn=w&rfm=pdf',
'http://www.jw.org/apps/U_sFFCsVrGZNT?rln=U&rmn=wp&rfm=pdf',
'http://www.jw.org/apps/E_sFFCsVrGZNT?rln=E&rmn=g&rfm=pdf',
'http://www.jw.org/apps/E_sFFCsVrGZNT?rln=E&rmn=w&rfm=pdf',
<?php if (!defined('APPLICATION')) exit();
/*
Copyright 2008, 2009 Vanilla Forums Inc.
This file is part of Garden.
Garden is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Garden is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Garden. If not, see <http://www.gnu.org/licenses/>.
Contact Vanilla Forums Inc. at support [at] vanillaforums [dot] com
*/