Skip to content

Instantly share code, notes, and snippets.

View danielkraaij's full-sized avatar

Daniel Kraaij danielkraaij

View GitHub Profile
@phred
phred / permission_hammer.sh
Created December 15, 2009 22:17
Fix Plesk's vhost group permissions nonsense. Stick this in a cron job to make the headaches go away.
#!/bin/sh
#
# A hammer to fix group permissions on Plesk vhosts.
#
# Plesk creates httpdocs directories with correct permissions initially,
# and they work properly over FTP (sort of), however, they require special
# love to let Apache write to them; namely putting Apache in the psacln
# group, making sure that everyone's httpdocs are owned by that group,
# and setting the setgid bit on httpdocs and all of its subdirectories
# so that new directories created by Apache inherit the proper permissions
@nyov
nyov / magento-cli.py
Last active August 15, 2021 12:57
A Magento REST API example with rauth as OAuth provider. For Magento 1
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from rauth.service import OAuth1Service
# Create consumer key & secret in your Magento Admin interface
# For an API Guideline see:
# http://www.magentocommerce.com/api/rest/authentication/oauth_authentication.html
#
# Short Magento setup explanation:
@RPDiep
RPDiep / removeoldkernels
Last active March 4, 2016 15:05
A script to remove old kernels in ubuntu
#!/bin/bash
kernelversion=$(uname -r)
kernelminversion=${kernelversion%-*}
latestkernelversion=$(dpkg -l | awk '/linux-image-[0-9]/ {print $2}' | sort | tail -1 | grep -o '[0-9][0-9\.-]*[0-9]')
packages_to_remove=$(dpkg -l | awk '/linux-(image|headers)-[0-9]/ {print $2}' | egrep -v "${kernelminversion}|${latestkernelversion}")
[[ -z "${packages_to_remove}" ]] || dpkg -P ${packages_to_remove}