Skip to content

Instantly share code, notes, and snippets.

View m13m's full-sized avatar
🏠
Working from home since 2021

Maqbool Khan m13m

🏠
Working from home since 2021
View GitHub Profile
@m13m
m13m / task.ex
Last active August 30, 2023 05:30
Task
defmodule FitnessWeb.ChatLive do
use FitnessWeb, :live_view
alias Fitness.Chats
alias Fitness.Repo
@impl true
def mount(_params, _session, socket) do
IO.inspect("mount invoked")
current_user = socket.assigns.current_user
@m13m
m13m / how-to-copy-aws-rds-to-local.md
Created April 9, 2021 14:48 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
@m13m
m13m / postgres-cheatsheet.md
Created March 6, 2021 02:34 — 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)
@m13m
m13m / generate-ssh-key.sh
Created January 28, 2021 12:53 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/mozilla_rsa
@m13m
m13m / ReadMe.md
Last active January 6, 2021 13:16

Hello 👋

@m13m
m13m / about.md
Created September 28, 2020 15:49

sudo certbot --server https://acme-v02.api.letsencrypt.org/directory -d *.example.com --manual --preferred-challenges dns-01 certonly

@m13m
m13m / ffmpeg.md
Created May 30, 2019 21:16 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

#Packages

sudo dnf install openssh-server.x86_64 openssh-clients.x86_64

@m13m
m13m / Useful Linux commands.md
Last active September 18, 2018 20:18
Linux Commands List which are useful but I always forget to use them
  1. strip - Discard symbols from object files. (lesser size)

  2. socat - Multipurpose relay (SOcket CAT)

  3. file — determine file type

  4. du - estimate file space usage

  5. readelf - Displays information about ELF files