This file contains 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
{{/* | |
* The gravatar shortcode: | |
* All arguments are optional, main ones are mail and size and have a fallback set in place. | |
* Args: | |
* mail: [string] The email address. Falls back to .Site.Params.gravatarEmail which should be set in your config file. | |
* size: [int] The size of the fetched image. Defaults to 200 if not set. | |
* class: [string] The class to give to the figure block. | |
* link: [string] The address to link the picture to. | |
* target: [string] Where to open the link. One of "_blank", "_self", "_parent", "_top". | |
* caption: [string] Caption text to show with the image. Supports Markdown. |
This file contains 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 | |
# usage: help - Lists all the available commands | |
# help <command> - Detailled explanation of how "command" works | |
if tty -s | |
then | |
HELPTEXT="Hi $USER, Run 'help' for help, 'help <command>' for specific help on a command, run 'exit' to exit. Available commands:" | |
else | |
HELPTEXT="Hi $USER, Run 'help' for help, 'help <command>' for specific help on a command. Available commands:" |
This file contains 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 | |
# usage: delete <REPOSITORY> - PERMANENTLY delete a repository if existing. | |
# CAREFUL, this action cannot be undone. This command will ask for confirmation. | |
GITDIR="/var/git" | |
function is_bare() { | |
repodir=$1 | |
if "$(git --git-dir="$repodir" rev-parse --is-bare-repository)" = true |
This file contains 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 | |
# usage: create <PROJECT> - create a git bare repository named PROJECT.git | |
# this command will setup the repo and send a mail for confirmation. | |
GITDIR="/var/git" | |
MULTIMAIL="/usr/doc/git-2.14.4/contrib/hooks/multimail/git_multimail.py" | |
GITUSER="git" | |
GITGRP="git" |
This file contains 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 | |
# DUALHEAD.SH - automatic script that toggles the secondary screen on and off | |
# requires xrandr and optionally feh to set the background image | |
# for the desktop(s). | |
### LVDS1 is the main screen on my laptop | |
### HDMI1 is the secondary screen attached via hdmi and is hanging on the wall | |
### above the laptop |
This file contains 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 | |
PASS=$(pwgen -s 40 1) | |
if [ -r /root/.my.cnf ]; then | |
mysql -uroot <<MYSQL_SCRIPT | |
CREATE DATABASE $1; | |
CREATE USER '$1'@'localhost' IDENTIFIED BY '$PASS'; | |
GRANT ALL PRIVILEGES ON $1.* TO '$1'@'localhost'; | |
FLUSH PRIVILEGES; |
This file contains 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
// opengraph metatags | |
function danixland_opengraph() { | |
global $post; | |
$output = ''; | |
$image = get_template_directory_uri() . '/img/standard-logo.png'; | |
if ( is_home() || is_front_page() ) { | |
$output = '<meta property="og:url" content="' . get_bloginfo('url') . '" />' . "\n"; | |
$output .= '<meta property="og:type" content="website" />' . "\n"; | |
$output .= '<meta property="og:title" content="' . wp_title('•', false, 'right') . '" />' . "\n"; |
This file contains 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 | |
# Author: Danilo 'danix' Macri | |
# Author URI: http://danixland.net | |
# Script URI: http://danixland.net/?p=3545 | |
# License: GPL2 | |
# License URI: https://www.gnu.org/licenses/gpl-2.0.html | |
#--------------------------------------------------------------------------------# | |
# # |
This file contains 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
// adds custom default gravatar for not logged in users | |
function sog_default_gravatar($avatar_defaults) { | |
$myavatar = get_bloginfo('stylesheet_directory') . '/images/mystery_danixland.jpg'; | |
$avatar_defaults[$myavatar] = "danixland"; | |
return $avatar_defaults; | |
} | |
add_filter( 'avatar_defaults', 'sog_default_gravatar' ); |
This file contains 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
# we have a test file | |
FILE=test.avi | |
# and we want to output just its filename without the extension | |
echo ${FILE%.avi} | |
# this returns | |
# test | |
# ;) |
NewerOlder