Skip to content

Instantly share code, notes, and snippets.

View ArchTaqi's full-sized avatar
🏠
Working from home

Muhammad Taqi ArchTaqi

🏠
Working from home
View GitHub Profile
@ArchTaqi
ArchTaqi / contribute-to-open-source.md
Created April 6, 2021 15:33
Contribute to Open-Source

Contribute to Open-Source

Basic Git workflow

The Git workflow you will be using is as follows:

  • Fork the repository to your GitHub account.
  • Clone the project on your machine.
#!/bin/bash -
export AWS_ACCESS_KEY=<your aws access key>
export AWS_SECRET_KEY=<your aws secret>
date_current=`date -u +%Y-%m-%d`
aws rds describe-db-snapshots --snapshot-type "automated" --db-instance-identifier <db_instance_name> | grep `date +%Y-%m-%d` | grep rds | tr -d '",' | awk '{ print $2 }' > /tmp/sandbox-snapshot.txt
snapshot_name=`cat /tmp/<db_instance_name>-snapshot.txt`
target_snapshot_name=`cat /tmp/<db_instance_name>-snapshot.txt | sed 's/rds://'`
@ArchTaqi
ArchTaqi / README.md
Created February 19, 2021 20:33 — forked from tjamps/README.md
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authentication
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :

@ArchTaqi
ArchTaqi / ubuntu_wifie.sh
Created January 20, 2021 10:27
No WiFi option in Ubuntu 18.04 in HP ProBook 450 G5
#!/bin/sh
git clone https://github.com/tomaspinho/rtl8821ce.git
cd rtl8821ce/
sudo make all
sudo make install
sudo modprobe -a 8821ce
@ArchTaqi
ArchTaqi / install-sonar-scanner.sh
Created January 18, 2021 12:18 — forked from chetanppatil/install-sonar-scanner.sh
Install sonar-scanner in linux mint, ubuntu...
#!/bin/bash
cd /tmp || exit
echo "Downloading sonar-scanner....."
if [ -d "/tmp/sonar-scanner-cli-3.2.0.1227-linux.zip" ];then
sudo rm /tmp/sonar-scanner-cli-3.2.0.1227-linux.zip
fi
wget -q https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.5.0.2216-linux.zip
echo "Download completed."
@ArchTaqi
ArchTaqi / clean_code.md
Created January 6, 2021 21:25 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@ArchTaqi
ArchTaqi / postgres-cheatsheet.md
Created December 29, 2020 21:36 — 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)
@ArchTaqi
ArchTaqi / Golang-setup.md
Last active November 22, 2020 08:54 — forked from saetia/gist:1623487
Setup macOS Catalina

Set variables in .bashrc file

don't forget to change your path correctly!

export GOPATH=$HOME/golang export GOROOT=/usr/local/opt/go/libexec export PATH=$PATH:$GOPATH/bin export PATH=$PATH:$GOROOT/bin

Set variables in .zshrc file

@ArchTaqi
ArchTaqi / How to set lets encrypt ssl.md
Created February 29, 2020 08:40
How to set lets encrypt ssl?

If you are using NGINX:

  1. sudo apt-get update
  2. sudo apt-get install software-properties-common
  3. sudo add-apt-repository universe
  4. sudo add-apt-repository ppa:certbot/certbot
  5. Execute sudo apt-get update again
  6. sudo apt-get install certbot python-certbot-nginx
  7. sudo certbot --nginx
@ArchTaqi
ArchTaqi / Assignment.md
Last active December 20, 2019 09:38
PIAIC Batch 3 Islamabad IoT - Quarter I: Rust Programming Assignment # 6

Q. Write a Rust Program

    1. define a custom datatype using Struct with your favorite name. Which contains 3 fields, and 1 should be String Type.
    1. In main function:
    • A. Create an instance of the above defined struct
    • B. Print complete instance
    • C. Print instance by calling its fields.
    • D. create another instance by using fields of first instance
    1. define user defined function, User defined function should receive some arguments and return an instance of your above defined struct.
    1. in main function call user defined function, Print instance returned by the user defined function.