Skip to content

Instantly share code, notes, and snippets.

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

Mohammad Khanafi thekingofbandit

🏠
Working from home
View GitHub Profile
@thekingofbandit
thekingofbandit / 000-Cheat-Sheets.md
Created January 28, 2023 18:12 — forked from JoshuaEstes/000-Cheat-Sheets.md
Developer Cheat Sheets for bash, git, gpg, irssi, mutt, tmux, and vim. See my dotfiles repository for extra info.
@thekingofbandit
thekingofbandit / m3u8-to-mp4.md
Created December 17, 2021 02:34 — forked from tzmartin/m3u8-to-mp4.md
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
#EXTM3U
#EXTINF:-1,BBC - Radio 1
http://open.live.bbc.co.uk/mediaselector/5/select/version/2.0/mediaset/http-icy-mp3-a/vpid/bbc_radio_one/format/pls.pls
#EXTINF:-1,BBC - Radio 2
http://open.live.bbc.co.uk/mediaselector/5/select/version/2.0/mediaset/http-icy-mp3-a/vpid/bbc_radio_two/format/pls.pls
#EXTINF:-1,BBC - Radio 3
http://open.live.bbc.co.uk/mediaselector/5/select/version/2.0/mediaset/http-icy-mp3-a/vpid/bbc_radio_three/format/pls.pls
#EXTINF:-1,BBC - Radio 4
http://open.live.bbc.co.uk/mediaselector/5/select/version/2.0/mediaset/http-icy-mp3-a/vpid/bbc_radio_fourfm/format/pls.pls
#EXTINF:-1,BBC - Radio 4 LW
@thekingofbandit
thekingofbandit / docker-compose.yml
Created July 27, 2021 08:20 — forked from crazyoptimist/compose.yaml
MongoDB Docker Deployment
version: "3.1"
services:
mongodb:
container_name: mongo
image: mongo
volumes:
- ./db_data/:/data/db/
ports:
- 27017:27017
restart: always
import { useState, useEffect } from 'react';
// Usage
function App() {
// Call our hook for each key that we'd like to monitor
const happyPress = useKeyPress('h');
const sadPress = useKeyPress('s');
const robotPress = useKeyPress('r');
const foxPress = useKeyPress('f');

SSH keys

Create

ssh-keygen -o

You can view the created files (one without extension and one with .pub) under ~/.ssh/. When creating several of them, you may want to rename them appropriately (e.g. work, pers...).

Add them

to the relevant github account: https://github.com/settings/ssh/new

Configuration

The configuration file for ssh is usually not created by default so we create it:

/*****************
* cellBlockA.js *
*****************
*
* Good morning, Dr. Eval.
*
* It wasn't easy, but I've managed to get your computer down
* to you. This system might be unfamiliar, but the underlying
* code is still JavaScript. Just like we predicted.
*
@thekingofbandit
thekingofbandit / Documentation.md
Created September 23, 2020 16:21 — forked from KartikTalwar/Documentation.md
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@thekingofbandit
thekingofbandit / array_iteration_thoughts.md
Created September 16, 2020 06:25 — forked from ljharb/array_iteration_thoughts.md
Array iteration methods summarized

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it much simpler to think about both the old list and the new one, what they contain, and

@thekingofbandit
thekingofbandit / request.js
Created July 4, 2020 18:45 — forked from sheharyarn/request.js
Axios Request Wrapper for React (https://to.shyr.io/axios-requests)
/**
* Axios Request Wrapper
* ---------------------
*
* @author Sheharyar Naseer (@sheharyarn)
* @license MIT
*
*/
import axios from 'axios'