Skip to content

Instantly share code, notes, and snippets.

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

Sudipto Das coderdipto

🏠
Working from home
  • Dhaka, Bangladesh
View GitHub Profile
@coderdipto
coderdipto / multiple_ssh_setting.md
Created November 9, 2022 14:11 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
Clean Code: By Robert C. Martin
The Mythical Man-month: By Frederick Brooks
The Pragmatic Programmer: Your Journey to Mastery
Code Complete (2 Edition): By Steve McConnell
The Art of Computer Programming
Programming Pearls
Code: Charles Petzold
Introduction to Algorithms
Refactoring: Improving the Design of Existing Code
Design Patterns: Elements of Reusable Object-Oriented Software
@coderdipto
coderdipto / subscriber.py
Created May 24, 2022 08:35
MQTT Subscriber
import time
import paho.mqtt.client as paho
from paho import mqtt
# setting callbacks for different events to see if it works, print the message etc.
def on_connect(client, userdata, flags, rc, properties=None):
"""
Prints the result of the connection with a reasoncode to stdout ( used as callback for connect )
@coderdipto
coderdipto / pm.js
Last active December 29, 2021 19:27
Prescript Postman for getting JWT access/refresh
const getRefreshToken = {
url: pm.environment.get("refresh_url"),
method: 'POST',
header: {
'Content-Type': 'application/json',
},
body: {
mode: 'raw',
raw: JSON.stringify({
refresh: pm.environment.get("refresh_token"),

Install Go (v1.16beta) on Apple Silicon, use with Homebrew

Go is not available to install via Homebrew at the time of this writing. (Dec 18th 2020)

Go v1.16 will ship with Apple Silicon support in February of 2021, however the Go 1.16 beta can be installed from the Go website and can be linked to brew so that other brew packages that depend on Go may use it.

  1. Install go1.16beta1.darwin-arm64.pkg.
  2. Run mkdir /opt/homebrew/Cellar/go
  3. Create a symlink to the Go v1.16 pkg installation with ln -s /usr/local/go /opt/homebrew/Cellar/go/1.16
  4. Run brew link go
@coderdipto
coderdipto / geodjango_macOS_arm64.md
Created November 28, 2021 20:19 — forked from codingjoe/geodjango_macOS_arm64.md
HowTo run GeoDjango and PostGIS on M1 macOS arm64 MacBook
  1. Install PostgreSQL with PostGIS via Postges.app
  2. Install brew as recommended.
  3. Install dependencies:
    brew install geos gdal
    
  4. Add the following to your settings:
    # settings.py
    

GDAL_LIBRARY_PATH = os.getenv('GDAL_LIBRARY_PATH')

@coderdipto
coderdipto / php.conf
Created October 1, 2020 16:39
NGINX for PHP
server {
        listen 80;
        server_name server.php.com;
        root /home/sudipto/workspace/phproot;
        index index.php;
        location / {
                try_files $uri $uri/ =404;
        }
@coderdipto
coderdipto / swap.sh
Last active January 20, 2022 05:10 — forked from Whistler092/swap.sh
Swap
sudo swapon -s
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
@coderdipto
coderdipto / swap.sh
Created September 8, 2020 08:03 — forked from Whistler092/swap.sh
swap
sudo swapon -s
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
@coderdipto
coderdipto / write_restricted_model_serializer.py
Created June 18, 2020 06:11 — forked from Kobold/write_restricted_model_serializer.py
A default read-only serializer for django-rest-framework as of DRF 2.4.
class RestrictedSerializerOptions(serializers.ModelSerializerOptions):
"""
Meta class options for ModelSerializer
"""
def __init__(self, meta):
super(RestrictedSerializerOptions, self).__init__(meta)
self.writable_fields = getattr(meta, 'writable_fields', ())
class WriteRestrictedModelSerializer(serializers.ModelSerializer):