Skip to content

Instantly share code, notes, and snippets.

@yusufhm
yusufhm / drupal-module-xmlsitemap-custom.php
Last active Jan 30, 2018
Add links programmatically to xmlsitemap
View drupal-module-xmlsitemap-custom.php
<?php
/**
* Implements hook_cron().
*/
function MYMODULE_cron() {
MYMODULE_xmlsitemap_links();
}
/**
@yusufhm
yusufhm / logstash-ossec-alerts.conf
Last active May 22, 2017
Logstash configuration for reading OSSEC alerts files and send to Elasticsearch (credits to https://mig5.net)
View logstash-ossec-alerts.conf
input {
file {
type => "ossec"
path => "/var/ossec/logs/alerts/alerts.log"
sincedb_path => "/opt/logstash/"
codec => multiline {
pattern => "^\*\*"
negate => true
what => "previous"
}
@yusufhm
yusufhm / git-config-multiple-remotes
Created Nov 7, 2014
Add 'all' origin in git for pushing to multiple remotes
View git-config-multiple-remotes
[remote "all"]
url = first@git.url
fetch = +refs/heads/*:refs/remotes/all/*
url = second@git.url
@yusufhm
yusufhm / .gitignore
Created Nov 7, 2014
Global .gitignore
View .gitignore
.sass-cache
.idea
.elasticbeanstalk
yusuf-local
node_modules
# Compiled source #
###################
*.com
*.class
@yusufhm
yusufhm / collectd-metrics-dashboard.json
Created Nov 10, 2014
collectd metrics dashboard for Kibana
View collectd-metrics-dashboard.json
{
"title": "Metrics",
"services": {
"query": {
"list": {
"0": {
"query": "collectd_type = \"memory\" and type_instance = \"used\"",
"alias": "Used",
"color": "#EF843C",
"id": 0,
@yusufhm
yusufhm / db_backup.sh
Last active Jun 20, 2020
Bash scripts to backup databases & files for Drupal sites. Adapted from scripts originally written by Joseph Chin.
View db_backup.sh
#!/usr/bin/env bash
WEBSITES_ROOT=/var/www
BACKUP_ROOT=/var/backups/websites
# Checks to see if arguments are provided
if [ $2 ]
then
BUCKET=$2
else
View ssh_config
Host some-name
Hostname server-address(ip or hostname)
User username
ForwardAgent yes
# The first parameter is the port which you will access from
# your local computer. The second is the IP & Port on the remote
# server that you want to access
LocalForward 8085 127.0.0.1:80
@yusufhm
yusufhm / syncthing.conf
Last active Aug 29, 2015
Ubuntu upstart script for syncthing
View syncthing.conf
description "Syncthing P2P sync service"
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [!2345]
env STNORESTART=yes
env HOME=/home/demouser
setuid "demouser"
setgid "demouser"
@yusufhm
yusufhm / vmstart-webserver.bat
Created Dec 2, 2014
Windows VirtualBox AutoStart (Headless?)
View vmstart-webserver.bat
"C:\Program Files\Oracle\VirtualBox\VBoxHeadless" -startvm "ubuntu-webserver-11.04-64" -p 3340
@yusufhm
yusufhm / nginx-rutorrent.enabled
Last active Aug 29, 2015
rutorrent nginx server
View nginx-rutorrent.enabled
server {
listen 80;
server_name some.server.name;
root /home/ubuntu/websites/rutorrent;
index index.html index.htm index.php;
location / {
try_files $uri $uri/ =404;
allow 10.9.0.0/24;