Skip to content

Instantly share code, notes, and snippets.

View nguyenthanhtung88's full-sized avatar

Nguyễn Thanh Tùng nguyenthanhtung88

  • Framgia Vietnam
  • Hanoi, Vietnam
View GitHub Profile
@nguyenthanhtung88
nguyenthanhtung88 / delete_git_submodule.md
Created November 2, 2018 06:03 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@nguyenthanhtung88
nguyenthanhtung88 / dbo_postgres.php
Created July 24, 2018 04:18
CakePHP 1.2.5 + PHP + Postgresql problem detect
<?php
/* SVN FILE: $Id$ */
/**
* PostgreSQL layer for DBO.
*
* Long description for file
*
* PHP versions 4 and 5
*

Components

  • Ubuntu 16.04
  • PHP 7.2
  • Mysql 5.7
  • Nginx
  • Redis (v3.0.6)
  • MongoDB (v1.4.2)
  • NodeJS (v9.11.1), Npm (v5.6.0), Yarn (v1.6.0)
  • Ruby (v2.3.1p112), SASS (v3.5.6)
@nguyenthanhtung88
nguyenthanhtung88 / [Ubuntu] Remove Apache2
Created March 1, 2017 22:13
Remove Apache2 in Ubuntu
1. Stop apache service:
```
sudo service apache2 stop
```
2. Remove and clean up all apache2 packages:
```
sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
```
<?php
class Collection implements IteratorAggregate
{
/**
* The collection contents.
*
* @var array
*/
protected $items;
@nguyenthanhtung88
nguyenthanhtung88 / laravel-quickstart-project-docker.md
Created October 31, 2016 06:38 — forked from wataridori/laravel-quickstart-project-docker.md
Running Laravel Quick Start Project easily using Docker
  • Install Docker
    • Docker for Ubuntu: https://docs.docker.com/engine/installation/linux/ubuntulinux/
      sudo apt-get update && apt-get install -y apt-transport-https ca-certificates
      sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
      
      // Open the /etc/apt/sources.list.d/docker.list and add the following line then save it
      // Ubuntu 14.04
      deb https://apt.dockerproject.org/repo ubuntu-trusty main
      

// Ubuntu 16.04

1. Setup crontab
```
$ crontab -e
59 23 * * * /home/john/bin/backup.sh
```
2. View log running
```
$ tail /var/log/cron
Oct 8 22:00:00 dev-db crond[18340]: (root) CMD (/bin/sh /home/root/bin/system_check &)
1. `vim /etc/syslog.conf`
2. Add to end of file: `cron.* /var/log/cron.log`
3.
```
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plist
```
[where-is-the-cron-log-file-in-macosx-lion](http://apple.stackexchange.com/questions/38861/where-is-the-cron-log-file-in-macosx-lion)
@nguyenthanhtung88
nguyenthanhtung88 / model.php
Created May 11, 2016 06:42 — forked from systemseven/model.php
Soft Deletes in Laravel 4
//in the model
class User extends Eloquent {
protected $softDelete = true;
}
//in the migration, to create a soft delete column
$table->softDeletes();