Skip to content

Instantly share code, notes, and snippets.

View sajjadintel's full-sized avatar

Sajad Abbasi sajjadintel

View GitHub Profile
@sajjadintel
sajjadintel / nosleep.sh
Created August 24, 2021 17:51
Completely disable sleep on any Mac
# Useful to prevent Macbooks to go to sleep when closing the lid instead of running tools that requires a Kernel Extension (e.g. InsomniaX) and more
# Before doing anything, save your current configuration using
pmset -g
# To disable sleep
sudo pmset -a sleep 0; sudo pmset -a hibernatemode 0; sudo pmset -a disablesleep 1;
# And to go back to normal
sudo pmset -a sleep 1; sudo pmset -a hibernatemode [original hibernatemode value]; sudo pmset -a disablesleep 0;
$ git remote rm origin
$ git remote add origin git@github.com:aplikacjainfo/proj1.git
$ git config master.remote origin
$ git config master.merge refs/heads/master
@sajjadintel
sajjadintel / unix_commands_mac.md
Created February 13, 2021 21:48 — forked from appym/unix_commands_mac.md
Unix commands Checklist for OSx

I have been meaning to note down my *nix checklist of commands (For MacOS) which are very handy for basic operations on data. I will modify this post as and when I remember or come across something that fits here. These *nix commands are specifically tested for Mac OS. Uniques
uniq - This is the unix unique function which can be primarily used to remove duplicates from a file amongst other things. The file has to be pre sorted for uniq to work Consider file test which contains the following

$ cat test
aa
bb
bb
cc
@sajjadintel
sajjadintel / Burp certificate on Android
Created January 27, 2021 19:00 — forked from PaulSec/Burp certificate on Android
Add your Burp certificate on an Android device
To do so:
1. Export your Burp Certificate
Proxy > Options > CA Certificate > Export in DER format
2. Convert it to PEM
openssl x509 -inform der -in cacert.der -out burp.pem
3. Download it on the device
@sajjadintel
sajjadintel / OAuthClient.java
Created July 10, 2020 08:22 — forked from dzolnai/OAuthClient.java
Retrofit OAuth2 refreshing tokens without modifying all requests.
package com.example.yourapp;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.example.yourapp.AuthenticationModel;
import retrofit.client.Header;
import retrofit.client.OkClient;
@sajjadintel
sajjadintel / guide.md
Created December 24, 2019 18:00 — forked from mindlapse/guide.md
A guide on how to use PaymentIntents with tipsi-stripe

Introduction

Card payments with Stripe should be performed with PaymentIntents.

This API was created to handle modern payments, where the cardholder's bank may require the user to authenticate themselves with the bank before a payment can be authorized.

Authentication requirements first started to appear with European banks regulated by PSD2 which introduced [Strong Customer Authentication

@sajjadintel
sajjadintel / DatabaseSeeder.php
Created August 13, 2019 07:30 — forked from bgallagh3r/DatabaseSeeder.php
Disable Foreign Key Constraints when Seeding DB with Artisan Migrate/DB Seed This prevents SQL from throwing errors when you try to do DB::table()->truncate() as TRUNCATE is disallowed when FK constraints are in place.
class DatabaseSeeder extends Seeder {
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Eloquent::unguard();
@sajjadintel
sajjadintel / EachDirectoryPath.md
Created April 2, 2019 11:03 — forked from granoeste/EachDirectoryPath.md
[Android] How to get the each directory path.

System directories

Method Result
Environment.getDataDirectory() /data
Environment.getDownloadCacheDirectory() /cache
Environment.getRootDirectory() /system

External storage directories

@sajjadintel
sajjadintel / mysql_backup.sh
Created June 12, 2018 12:33 — forked from tleish/mysql_backup.sh
Bash Script to backup all MySQL databases
#!/bin/bash
#==============================================================================
#TITLE: mysql_backup.sh
#DESCRIPTION: script for automating the daily mysql backups on development computer
#AUTHOR: tleish
#DATE: 2013-12-20
#VERSION: 0.4
#USAGE: ./mysql_backup.sh
#CRON:
# example cron for daily db backup @ 9:15 am
@sajjadintel
sajjadintel / 0.README.md
Created June 9, 2018 13:16 — forked from agentcooper/0.README.md
Telegram chat backup/export

How to use

  1. Login to https://web.telegram.org
  2. Copy-paste contents of telegram-scripts.js into JS console
  3. Run showContacts() to get the list of contacts with ids
  4. Run saveChat(userId) where userId is the id from step 3

Process can take a while, check console for progress. Occasionall FLOOD_WAIT errors are expected. Once done, browser will download the JSON file.

Motivation