Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@yusufhm
yusufhm / drupal-module-xmlsitemap-custom.php
Last active January 30, 2018 09:56
Add links programmatically to xmlsitemap
<?php
/**
* Implements hook_cron().
*/
function MYMODULE_cron() {
MYMODULE_xmlsitemap_links();
}
/**
@yusufhm
yusufhm / logstash-ossec-alerts.conf
Last active May 22, 2017 16:54
Logstash configuration for reading OSSEC alerts files and send to Elasticsearch (credits to https://mig5.net)
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 November 7, 2014 07:20
Add 'all' origin in git for pushing to multiple remotes
[remote "all"]
url = first@git.url
fetch = +refs/heads/*:refs/remotes/all/*
url = second@git.url
@yusufhm
yusufhm / .gitignore
Created November 7, 2014 07:24
Global .gitignore
.sass-cache
.idea
.elasticbeanstalk
yusuf-local
node_modules
# Compiled source #
###################
*.com
*.class
@yusufhm
yusufhm / collectd-metrics-dashboard.json
Created November 10, 2014 05:01
collectd metrics dashboard for Kibana
{
"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 June 20, 2020 02:12
Bash scripts to backup databases & files for Drupal sites. Adapted from scripts originally written by Joseph Chin.
#!/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
@yusufhm
yusufhm / ssh_config
Last active August 30, 2016 08:31
SSH Tunnel
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 August 29, 2015 14:10
Ubuntu upstart script for syncthing
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 December 2, 2014 08:39
Windows VirtualBox AutoStart (Headless?)
"C:\Program Files\Oracle\VirtualBox\VBoxHeadless" -startvm "ubuntu-webserver-11.04-64" -p 3340
@yusufhm
yusufhm / nginx-rutorrent.enabled
Last active August 29, 2015 14:10
rutorrent nginx server
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;