Skip to content

Instantly share code, notes, and snippets.

View dinhkhanh's full-sized avatar

Trần Đình Khánh dinhkhanh

View GitHub Profile
@stilliard
stilliard / gdrive-backup-setup.sh
Last active May 8, 2020 22:24
Backup server files with Google Drive
# ref: https://github.com/prasmussen/gdrive
# prerequisite:
# In google drive, setup your folder for storing the backups
# Then grab the code from the url e.g. https://drive.google.com/drive/folders/xxxxx where xxxxx is the code
# This code will be used later in the cron command, keep it secret, keep it safe
# install gdrive sync for backups
wget https://drive.google.com/uc?id=0B3X9GlR6EmbnQ0FtZmJJUXEyRTA -O /usr/local/bin/gdrive
chmod 755 /usr/local/bin/gdrive
@ipbastola
ipbastola / clean-up-boot-partition-ubuntu.md
Last active May 2, 2024 01:27
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@cklm
cklm / MenuBuilder.php
Last active December 27, 2022 17:08 — forked from nielsmouthaan/MenuBuilder.php
Custom KnpMenuBundle navigation bar twig template to support Font Awesome icons & Twitter bootstrap lay-out
<?php
namespace Acme\HelloBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
class MenuBuilder extends ContainerAware
{
public function mainMenu(FactoryInterface $factory, array $options)
@tomazzaman
tomazzaman / hhvm.conf
Last active May 13, 2021 19:44
Monit configurations for commonly used services
check process hhvm with pidfile /var/run/hhvm/pid
group hhvm
start program = "/usr/sbin/service hhvm start" with timeout 60 seconds
stop program = "/usr/sbin/service hhvm stop"
if failed unixsocket /var/run/hhvm/hhvm.sock then restart
if mem > 400.0 MB for 1 cycles then restart
if 5 restarts with 5 cycles then timeout
@ajaxray
ajaxray / 1_DocumentSerializer.php
Last active July 3, 2018 10:54
A simple PHP Trait to make Doctrine MongoDB ODM Documents serializable to Array or JSON
<?php
/**
* Created by PhpStorm.
* Author: Anis Ahmad <anisniit@gmail.com>
* Date: 5/11/14
* Time: 10:44 PM
*/
namespace Your\CoreBundle\Traits;
@abdev
abdev / gist:2376792
Created April 13, 2012 13:17
Magento -update product attribute backend type
$installer = new Mage_Eav_Model_Entity_Setup('core_setup');
$entityTypeId = $installer->getEntityTypeId('catalog_product');
// replace <my_attribute_code> with your attribute code
$idAttribute = $installer->getAttribute($entityTypeId, '<my_attribute_code>', 'attribute_id');
$installer->updateAttribute($entityTypeId, $idAttribute, array(
'backend_type' => 'varchar'
));
// let's see if it worked
$attribute = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', '<my_attribute_code>');
@leek
leek / _Magento1_DeleteTestData.md
Last active December 29, 2023 09:51
Magento 1 - Delete All Test Data

These set of scripts are for Magento 1. For Magento 2, see this Gist.