Skip to content

Instantly share code, notes, and snippets.

View apermuy's full-sized avatar
💭
I may be slow to respond.

Alberto Permuy Leal apermuy

💭
I may be slow to respond.
View GitHub Profile
@shamil
shamil / mount_qcow2.md
Last active September 23, 2026 00:20
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
@avh4
avh4 / btsync.sh
Created October 30, 2013 04:51
startup script for running BitTorrent Sync on Synology NAS
#!/bin/sh
#
# Put this file in /usr/local/etc/rc.d/btsync.sh
case "$1" in
stop)
echo "Stop BitTorrent Sync..."
kill "`cat /volume1/homes/btsync/bin/.sync/sync.pid`"
kill "`cat /volume1/homes/btsync/bin/.sync/sync.pid`"
@Stanback
Stanback / nginx.conf
Last active February 6, 2026 04:08 — forked from michiel/cors-nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
<?php
/**
* This file will demonstrate a method to export fields to code.
* You can use this to easily create fields using the UI, export to code
* and then use in a custom module. Upon installation of the module
* your fields and instances will already be set up.
*/
// Create the fields you want using the Drupal UI.
// On the same site, go to example.com/devel/php
@garethrees
garethrees / gist:5591027
Last active October 14, 2020 19:44
Ansible set timezone on Ubuntu host
- name: Group by Distribution
hosts: all
tasks:
- group_by: key=${ansible_distribution}
- name: Set Time Zone
hosts: Ubuntu
gather_facts: False
tasks:
- name: Set timezone variables
@fuzzmz
fuzzmz / email.sh
Created March 30, 2013 22:55
Script to send email on Debian based server at shutdown and restart.
#!/bin/sh
### BEGIN INIT INFO
# Provides: SystemEmail
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Send email
# Description: Sends an email at system start and shutdown
### END INIT INFO
@ck-on
ck-on / ocp.php
Last active August 17, 2026 20:36
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)#ocp #php #opcache #opcode #cache #zend #optimizerplus #optimizer+
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.7
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.7 2015-09-01 regex fix for PHP7 phpinfo
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
@revagomes
revagomes / batch_api_example.module
Created December 18, 2012 16:04
Drupal Batch API Example
<?php
function skeleton_menu() {
$items['admin/skeleton/batch'] = array(
'title' => 'Skeleton Batch',
'page callback' => 'skeleton_batch_init',
'access arguments' => array('Administer content'),
'type' => MENU_NORMAL_ITEM,
);
@abemassry
abemassry / curl_post_update.php
Created July 25, 2012 15:54
PHP script to log into a drupal site and update a form using curl, can be used with other sites besides drupal
<?php
//
// curl_post_update.php
// You can modify this script to make PHP use a webpage like a person sitting
// at a computer would use a webpage.
//
// tags: #php #curl #form
//
// This script is licensed under the JSON licence http://www.json.org/license.html
// "The Software shall be used for Good, not Evil." style license
@level09
level09 / rebuild_permissions
Created July 21, 2012 12:02
Drush: rebuild permissions table using command line in Drupal
drush php-eval 'node_access_rebuild();'