Skip to content

Instantly share code, notes, and snippets.

View bangil0's full-sized avatar
🤲
Thanks

Saiful Rahman bangil0

🤲
Thanks
  • Bangil, Pasuruan, Jawa Timur. ID
View GitHub Profile
@bangil0
bangil0 / git-cheatsheet.md
Created June 10, 2022 06:08 — forked from Kartones/git-cheatsheet.md
Git cheatsheet

Commands

  • git checkout -b __newbranch__ : get a new branch and switch to it
  • git checkout -b __branchname__ / __branchname__ : get a local copy of a remote existing branch
  • git checkout __branchname__ : switch branch
  • git checkout --orphan __branchname__ : create branch without full history
  • git log -n X -p : show X last commits with diffs
  • git log __branchA__ ^__branchB__ : commits in branch A that aren't in branch B
  • git log --pretty=oneline --stat --all __foldername__ : modified files under a given folder
@bangil0
bangil0 / postgres-cheatsheet.md
Created June 10, 2022 03:42 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some 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)
@bangil0
bangil0 / numberToWordsID.php
Created December 29, 2020 07:09 — forked from fzn0x/numberToWordsID.php
Number To Words - Indonesia
/**
*
* (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
@bangil0
bangil0 / exporters.py
Created November 21, 2020 08:32 — forked from sachinchaturvedi93/exporters.py
Change the settings file in the monster directory. Also add exporters.py to the spiders directory. Note : This is for removing blanks in CSV files in Windows.
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
@bangil0
bangil0 / openssl_encrypt_decrypt.md
Created January 9, 2020 03:14
Replace mcrypt_encrypt with openssl_encrypt
@bangil0
bangil0 / .htaccess
Created November 27, 2019 04:24 — forked from jwhulette/.htaccess
A base .htaccess with HTTPS redirect behind an AWS Load Balancer
<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
<?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()
{
@bangil0
bangil0 / postgresql-set-id-seq.sql
Created October 29, 2019 15:28 — forked from henriquemenezes/postgresql-set-id-seq.sql
PostgreSQL set Next ID Sequence Value to MAX(id) from Table
-- 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));