git checkout -b __newbranch__: get a new branch and switch to itgit checkout -b __branchname__ / __branchname__: get a local copy of a remote existing branchgit checkout __branchname__: switch branchgit checkout --orphan __branchname__: create branch without full historygit log -n X -p: show X last commits with diffsgit log __branchA__ ^__branchB__: commits in branch A that aren't in branch Bgit log --pretty=oneline --stat --all __foldername__: modified files under a given folder
Magic words:
psql -U postgresSome interesting flags (to see all, use -h or --help depending on your psql version):
-E: will describe the underlaying queries of the\commands (cool for learning!)-l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * | |
| * (C) 2020 Muhammad Fauzan | |
| * This program is free software: you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation, either version 3 of the License, or | |
| * (at your option) any later version. | |
| * | |
| * This program is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import io | |
| import os | |
| import six | |
| import csv | |
| from scrapy.exporters import CsvItemExporter | |
| from scrapy.extensions.feedexport import IFeedStorage | |
| from w3lib.url import file_uri_to_path | |
| from zope.interface import implementer |
The url has changed: https://odan.github.io/2017/07/14/replace-mcrypt-encrypt-with-openssl-encrypt.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <IfModule mod_rewrite.c> | |
| <IfModule mod_negotiation.c> | |
| Options -MultiViews | |
| </IfModule> | |
| RewriteEngine On | |
| # Force HTTPS - Proto needed for AWS ELB | |
| RewriteCond %{HTTP:X-Forwarded-Proto} !https | |
| RewriteCond %{HTTP_USER_AGENT} !^ELB-HealthChecker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| defined('BASEPATH') OR exit('No direct script access allowed'); | |
| // Codeigniter 3 usage : | |
| // Set config/config.app: | |
| // $config['composer_autoload'] = 'vendor/autoload.php'; | |
| use Ozdemir\Datatables\Datatables; | |
| use Ozdemir\Datatables\DB\CodeigniterAdapter; | |
| class Welcome extends CI_Controller { | |
| public function index() | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Get Max ID from table | |
| SELECT MAX(id) FROM table; | |
| -- Get Next ID from table | |
| SELECT nextval('table_id_seq'); | |
| -- Set Next ID Value to MAX ID | |
| SELECT setval('table_id_seq', (SELECT MAX(id) FROM table)); |