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
# Place this in /etc/logrotate.d/duplicity | |
/var/log/duplicity.log { | |
maxsize 100K | |
missingok | |
rotate 10 | |
compress | |
notifempty | |
create 0640 pi root | |
} |
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 | |
# add the following towards the end of wpforo/wpforo.php using plugin editor (before the final }) | |
add_filter( 'slack_get_events', function( $events ) { | |
$events['wpforo_after_add_topic'] = array( | |
'action' => 'wpforo_after_add_topic', | |
'description' => __( 'When a forum post is published', 'slack' ), | |
'default' => false, | |
'message' => function( $args ) { | |
$excerpt = wp_trim_words( strip_shortcodes( $args['body'] ), 55, '…' ); |
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
# put this file in /etc/systemd/system/ as root | |
# below paths assume solr installed in /opt/solr, SOLR_PID_DIR is /data | |
# and that all configuration exists in /etc/default/solr.in.sh which is the case if previously installed as an init.d service | |
# change port in pid file if differs | |
# note that it is configured to auto restart solr if it fails (Restart=on-faliure) and that's the motivation indeed :) | |
# to switch from systemv (init.d) to systemd, do the following after creating this file: | |
# sudo systemctl daemon-reload | |
# sudo service solr stop # if already running | |
# sudo systemctl enable solr | |
# systemctl start solr |
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 | |
echo "Prerequisites:" | |
echo "sudo apt-get install awscli" | |
echo "aws configure" | |
echo "Usage:" | |
echo "aws s3 ls s3://BUCKET/PREFIX/ | cut -c32- | ./clean-logs.sh" | |
bucket=SET_BUCKET_NAME | |
prefix=SET_PREFIX |
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
<!-- | |
If your input file is in Excel format, use xlsx2csv python tool available at | |
https://github.com/dilshod/xlsx2csv | |
Usage is simple, you need ruby installed (including erb) | |
rename the input file to input.csv, then just run: | |
erb csv2webcards.erb > output.html | |
Now open output.html in any browser to see the HTML cards | |
Author: Hossam Hammady ([email protected]) | |
--> |
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
{"error": 42716.2954, "samples": 506, "value": [22.532806324110698], "label": "RM <= 6.94", "type": "split", "children": [{"error": 17317.3210, "samples": 430, "value": [19.93372093023257], "label": "LSTAT <= 14.40", "type": "split", "children": [{"error": 6632.2175, "samples": 255, "value": [23.349803921568636], "label": "DIS <= 1.38", "type": "split", "children": [{"error": 390.7280, "samples": 5, "value": [45.58], "label": "CRIM <= 10.59", "type": "split", "children": [{"error": 0.0000, "samples": 4, "value": [50.0], "label": "Leaf - 4", "type": "leaf"}, {"error": 0.0000, "samples": 1, "value": [27.9], "label": "Leaf - 5", "type": "leaf"}]}, {"error": 3721.1632, "samples": 250, "value": [22.90520000000001], "label": "RM <= 6.54", "type": "split", "children": [{"error": 1636.0675, "samples": 195, "value": [21.629743589743576], "label": "LSTAT <= 7.57", "type": "split", "children": [{"error": 129.6307, "samples": 43, "value": [23.969767441860473], "label": "TAX <= 222.50", "type": "split", "children": [{"err |
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
# Patch ROCR R package to support plotting of WSS (Work Saved over Sampling) | |
# Author: Hossam Hammady ([email protected]) | |
# Organization: Qatar Computing Research Institute; Data Analytics Group (http://da.qcri.qa) | |
# Date: 17-Feb-2014 | |
# License: MIT | |
# Description: After sourcing this patch, you can use "wss" as a new measure in | |
# .. plotting performance curves, same like fp, tp, rec, auc, ... | |
# .. You should have ROCR installed and imported first | |
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 | |
if [ $# -ne 3 ]; then | |
echo "Usage: $0 <substitute-path> <with-path> <css-file>" | |
exit 1 | |
fi | |
from=$1 | |
to=$2 | |
file=$3 |
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/local/bin/ruby | |
# A script to download the latest episodes from railscasts.com | |
# | |
# author: modsaid <[email protected]> | |
# mechanize support: Hossam Hammady <[email protected]> | |
# gem install mechanize | |
require 'rubygems' | |
require 'mechanize' |
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
# See http://m.onkey.org/running-rails-performance-tests-on-real-data | |
# fixed to work with Rails 3.2.8 | |
# START : HAX HAX HAX | |
# Load Rails environment in 'test' mode | |
RAILS_ENV = "test" | |
require File.expand_path('../../config/environment', __FILE__) | |
# Re-establish db connection for 'performance' mode | |
silence_warnings { RAILS_ENV = "performance" } |
NewerOlder