Skip to content

Instantly share code, notes, and snippets.

View muhannad0's full-sized avatar

Monde muhannad0

View GitHub Profile
@muhannad0
muhannad0 / hugo.gitignore
Last active May 12, 2020 07:03
Sample gitignore for Hugo projects
### Hugo ###
# Generated files by hugo
/public/
/resources/_gen/
# Executable may be added to repository
hugo.exe
hugo.darwin
hugo.linux
@muhannad0
muhannad0 / handler.js
Last active June 20, 2020 21:55
running a telegram bot on aws lambda
'use strict';
const getResponseHeaders = () => {
return {
'Access-Control-Allow-Origin': '*'
};
}
const helpMsg = `Command reference:
/start - Start bot
@muhannad0
muhannad0 / MoviesCreateTable.py
Created July 18, 2020 22:36
Python unittest example for DynamoDB operations using moto library
from pprint import pprint
import boto3
def create_movie_table(dynamodb=None):
if not dynamodb:
dynamodb = boto3.resource('dynamodb', endpoint_url='http://localhost:8000')
table = dynamodb.create_table(
TableName='Movies',
KeySchema=[
@muhannad0
muhannad0 / README.md
Created November 11, 2023 06:47
yt-dlp usage notes

yt-dlp docker usage notes

Download audio only

# from a playlist
docker run --rm -v $(pwd):/downloads jauderho/yt-dlp -x --audio-format mp3 --yes-playlist '<playlist url>'

# single video
docker run --rm -v $(pwd):/downloads jauderho/yt-dlp -x --audio-format mp3 '<video-url>'
@muhannad0
muhannad0 / aws-cli-scripts.md
Created January 8, 2024 05:49
quick-aws-cli-scripts

AWS CLI scripts for quick tasks

Get all the EC2 instances with a specific Name tag, and add/update tags on those resources

aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId, Tags[?Key==`Name` && starts_with(Value, `dev`)]]' --output json | jq -r '.[][] | select(.[1] | length > 0) | .[0]' | \
while read instance_id; do
  aws ec2 create-tags --resources "$instance_id" --tags Key=Environment,Value=development
done
  • jq used to filter out resources that have empty tags and only output the instance ID.