Skip to content

Instantly share code, notes, and snippets.

View andhikayuana's full-sized avatar
🌏
bertapa

Andhika Yuana andhikayuana

🌏
bertapa
View GitHub Profile
@trvswgnr
trvswgnr / compress_video
Last active November 12, 2024 21:17
portable shell script to compress videos with ffmpeg
#!/bin/sh
print_usage() {
echo "usage: compress_video <input_file>"
echo "supported formats: mp4, webm, mkv, mov, avi, flv"
}
get_extension() {
f="${1##*/}"
case "$f" in
@Spikeysanju
Spikeysanju / ffmpeg-cheatsheet.md
Last active August 27, 2024 03:26
A comprehensive cheatsheet of FFmpeg commands with descriptions and examples, covering video and audio processing tasks such as format conversion, resizing, trimming, extracting audio, and adding effects.

FFmpeg Cheatsheet

Common FFmpeg Options

Option Description Example
-i Input file ffmpeg -i input.mp4
-vf Video filters (apply effects to video) ffmpeg -i input.mp4 -vf "scale=1280:720" output.mp4
-c:v Video codec (specify video compression method) ffmpeg -i input.mp4 -c:v libx264 output.mp4
-c:a Audio codec (specify audio compression method) ffmpeg -i input.mp4 -c:a aac output.mp4
@ahmadrosid
ahmadrosid / write-fixer.py
Created April 17, 2024 10:02
Fixed typos, spelling mistakes, and grammar while maintaining clarity and a concise tone using Claude.
import sys
import anthropic
from dotenv import load_dotenv
load_dotenv()
client = anthropic.Anthropic()
prompt_template = """
Please review and edit the following text to ensure it is grammatically correct, clear, and concise. Aim to maintain a casual tone without being overly informal. Provide suggestions for improvement and explain any changes you make. Do not add double quotes in you rewrite answer. Answer in direct response.
@kamilogorek
kamilogorek / _screenshot.md
Last active September 18, 2024 03:05
Clutter-free VS Code Setup
image
@lewdev
lewdev / worksheet-generators.md
Last active September 25, 2024 04:46
🏫📄 Worksheet Generators List
@andrimuhyidin
andrimuhyidin / gcr-cleaner.sh
Last active June 8, 2022 13:50
Deleting unused image tags from Google Container Registry, leaving x number left
#!/bin/bash
IFS=$'\n\t'
set -eou pipefail
if [[ "$#" -ne 3 || "${1}" == '-h' || "${1}" == '--help' ]]; then
cat >&2 <<"EOF"
gcr-cleaner.sh will cleans up the gcr tags or untaged images pushed in a repository (image name with the specific tag)
and except the given number most recent images.
@colinrtwhite
colinrtwhite / complex_forwarding_painter.kt
Last active October 26, 2024 09:03
A painter that wraps another painter to overwrite its color filter, alpha, and/or onDraw.
/**
* Create and return a new [Painter] that wraps [painter] with its [alpha], [colorFilter], or [onDraw] overwritten.
*/
fun forwardingPainter(
painter: Painter,
alpha: Float = DefaultAlpha,
colorFilter: ColorFilter? = null,
onDraw: DrawScope.(ForwardingDrawInfo) -> Unit = DefaultOnDraw,
): Painter = ForwardingPainter(painter, alpha, colorFilter, onDraw)
@mxalbert1996
mxalbert1996 / Scrollbar.kt
Last active October 28, 2024 09:30
Modifiers to draw scrollbars in Jetpack Compose
/*
* MIT License
*
* Copyright (c) 2022 Albert Chang
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@amal
amal / Tooltip.kt
Last active July 10, 2024 15:05
How to show a tooltip in AndroidX Jetpack Compose?
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
// Tooltip implementation for AndroidX Jetpack Compose
// See usage example in the next file
// Tested with Compose version **1.1.0-alpha06**
// Based on material DropdownMenu implementation.
import androidx.compose.animation.core.MutableTransitionState
import androidx.compose.animation.core.animateFloat
@LongClipeus
LongClipeus / HashUtils.kt
Last active March 13, 2024 11:54
How to generate checksum hash for a file in Kotlin
import StringUtils.encodeHex
import java.io.File
import java.io.FileInputStream
import java.io.InputStream
import java.security.MessageDigest
object HashUtils {
const val STREAM_BUFFER_LENGTH = 1024