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 / calendar.php
Created October 30, 2019 20:31
Google Calendar API in PHP Projects
<?php
require_once __DIR__ . '/vendor/autoload.php';
ini_set('display_errors', 1);
define('SCOPES', "https://www.googleapis.com/auth/calendar");
################################################################################
##### For google-api-php-client Version v2.0.0-RC2 and pem key file format #####
################################################################################
define('KEY_FILE',dirname(__FILE__).'service-account.p12');
@ArchTaqi
ArchTaqi / Google_Calendar_API.php
Last active May 5, 2020 00:47
Google Calendar API in Python Projects
<?php
require_once __DIR__ . '/vendor/autoload.php';
ini_set('display_errors', 1);
######
define('CALENDAR_ID', '[email protected]');
define('CREDENTIALS_PATH', __DIR__ . '/app/config/private/service-account.json');
define('SCOPES', Google_Service_Calendar::CALENDAR);
$googleClient = new Google_Client();
@ArchTaqi
ArchTaqi / main.rs
Last active November 29, 2019 16:02
PIAIC Batch 3 IoT - Assignment # 4
#![allow(dead_code)]
#![allow(unused_variables)]
fn main() {
check_positive_negative_zero(55);
print_arguments(25, 5.4, false);
println!("{:#?}", square_the_number(4));
}
// Q # 1. Write a rust program, define a function that receives one argument of any suitable data
@ArchTaqi
ArchTaqi / main.rs
Created December 6, 2019 20:21
PIAIC IOT - Assignment # 5
#![allow(dead_code)]
#![allow(unused_variables)]
fn main() {
let mut name = String::new();
let mut subject_one = String::new();
let mut subject_two = String::new();
println!("enter your name");
std::io::stdin().read_line(&mut name).ok().expect("Couldn't read line!");
@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.
@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 / 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 / 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 / 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 / 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."