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
<?php | |
$json = '{"image_intro":"storage\/images\/media\/fotografies\/thumbnail.jpg","float_intro":"","image_intro_alt":"fragkoul | |
$obj = json_decode($json); | |
echo $obj->{'image_intro'} . '<br>'; | |
?> |
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
/* Restrict users viewing their own attachments */ | |
add_filter('pre_get_posts', 'restrict_media'); | |
function restrict_media($arg) { | |
global $user_ID; | |
if ( current_user_can('editor') ) { // Disable this to apply on all roles | |
if ($arg->query['post_type'] == 'attachment' && is_admin()) { | |
$arg->query['author'] = $user_ID; | |
$arg->query_vars['author'] = $user_ID; | |
} | |
} |
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
#!/usr/bin/python -u | |
import sys, os, time | |
import random | |
class DNSLookup(object): | |
"""Handle PowerDNS pipe-backend domain name lookups.""" | |
ttl = 30 | |
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
# Kernel sysctl configuration file for Red Hat Linux | |
# | |
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and | |
# sysctl.conf(5) for more details. | |
# Turn on execshield | |
# 0 completely disables ExecShield and Address Space Layout Randomization | |
# 1 enables them ONLY if the application bits for these protections are set to “enable” | |
# 2 enables them by default, except if the application bits are set to “disable” | |
# 3 enables them always, whatever the application bits |
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
CREATE USER 'backupadmin'@'localhost' IDENTIFIED BY '<secret_password>'; | |
GRANT LOCK TABLES, SELECT ON <DB_NAME>.* TO 'backupadmin'@'localhost'; | |
GRANT RELOAD ON *.* TO 'backupadmin'@'localhost'; | |
GRANT CREATE, INSERT, DROP ON mysql.ibbackup_binlog_marker TO 'backupadmin'@'localhost'; | |
GRANT CREATE, INSERT, DROP ON mysql.backup_progress TO 'backupadmin'@'localhost'; | |
GRANT CREATE, INSERT, SELECT, DROP ON mysql.backup_history TO 'backupadmin'@'localhost'; | |
GRANT REPLICATION CLIENT ON *.* TO 'backupadmin'@'localhost'; | |
GRANT SUPER ON *.* TO 'backupadmin'@'localhost'; | |
GRANT CREATE TEMPORARY TABLES ON mysql.* TO 'backupadmin'@'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
#!/usr/bin/perl -w | |
# | |
# Listen for Cisco Discovery Protocol (CDP) packets | |
# and print out key values such as switch, port and vlan. | |
# | |
# This script depends on either "snoop" (Solaris) or | |
# "tcpdump" (Linux, AIX, and others). Both of those programs generally | |
# must be run as root. | |
# | |
# It has been tested on Solaris 10 and Linux (CentOS, Ubuntu) |
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
SELECT CONCAT('ALTER TABLE `',table_schema,'`.`',table_name,'` engine=InnoDB;') FROM information_schema.tables WHERE TABLE_SCHEMA='<MY_DATABASE>' AND ENGINE = 'MyISAM'; |
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
" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just | |
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime | |
" you can find below. If you wish to change any of those settings, you should | |
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten | |
" everytime an upgrade of the vim packages is performed. It is recommended to | |
" make changes after sourcing debian.vim since it alters the value of the | |
" 'compatible' option. | |
" This line should not be removed as it ensures that various options are | |
" properly set to work with the Vim-related packages available in Debian. |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'grok-pure' | |
require 'pp' | |
grok = Grok.new | |
grok.add_patterns_from_file("grok-patterns") | |
pattern = 'your_grok_pattern' |
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
# Please make this file available to others | |
# by sending it to <[email protected]> | |
# | |
# this config file was automatically generated | |
# using lirc-0.9.0-pre1(default) on Sun Jan 11 20:58:28 2015 | |
# | |
# contributed by | |
# | |
# brand: /home/pi/lircd.conf | |
# model no. of remote control: |
OlderNewer