mirror of
https://github.com/srid/nixos-config.git
synced 2026-01-06 23:49:03 +08:00
More cleanup
This commit is contained in:
parent
276da56045
commit
63541aa6ed
5 changed files with 0 additions and 131 deletions
|
|
@ -1,16 +0,0 @@
|
|||
{ writeShellApplication, wl-clipboard, pandoc, ... }:
|
||||
|
||||
writeShellApplication {
|
||||
name = "copy-md-as-html";
|
||||
meta.description = ''
|
||||
Convert the given Markdown to HTML (using pandoc) and copy it to the clipboard.
|
||||
|
||||
This is useful for pasting Markdown content into rich text editors or GUI email clients (like Gmail).
|
||||
'';
|
||||
runtimeInputs = [ wl-clipboard pandoc ];
|
||||
text = ''
|
||||
set -x
|
||||
pandoc "$1" -t html | wl-copy -t text/html
|
||||
echo "Copied HTML to clipboard"
|
||||
'';
|
||||
}
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
{ writeShellApplication, git, ... }:
|
||||
|
||||
writeShellApplication {
|
||||
name = "git-merge-and-delete";
|
||||
meta.description = ''
|
||||
Merge the given branch to `main`, push and clean everything up.
|
||||
'';
|
||||
runtimeInputs = [ git ];
|
||||
text = ''
|
||||
# Set some fancy colors
|
||||
RED='\033[0;31m'
|
||||
# GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Function to print colorful messages
|
||||
print_message() {
|
||||
>&2 echo -e "''${YELLOW}🚀 $1''${NC}"
|
||||
}
|
||||
|
||||
# Function to print and execute git commands
|
||||
git_command() {
|
||||
>&2 echo -e "''${BLUE}> git $*''${NC}"
|
||||
git "$@"
|
||||
}
|
||||
|
||||
# Check if branch name is provided
|
||||
if [ $# -eq 0 ]; then
|
||||
echo -e "''${RED}❌ Error: No branch name provided. Usage: $0 <branch_name>''${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BRANCH_NAME=$1
|
||||
|
||||
# Check if we're on the correct branch
|
||||
current_branch=$(git_command rev-parse --abbrev-ref HEAD)
|
||||
if [ "$current_branch" != "$BRANCH_NAME" ]; then
|
||||
echo -e "''${RED}❌ Oops! You're not on the '$BRANCH_NAME' branch. Aborting mission!''${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check for dirty changes
|
||||
if ! git_command diff-index --quiet HEAD --; then
|
||||
echo -e "''${RED}❌ Houston, we have a problem! There are uncommitted changes. Commit or stash them first.''${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
print_message "All systems go! Preparing for merge..."
|
||||
|
||||
# Switch to main branch
|
||||
git_command checkout main
|
||||
|
||||
# Merge the specified branch into main
|
||||
if git_command merge "$BRANCH_NAME"; then
|
||||
print_message "Merge successful! Ready for liftoff..."
|
||||
else
|
||||
echo -e "''${RED}❌ Merge conflict detected! Abort! Abort!''${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Push changes to remote
|
||||
print_message "Pushing changes to the mothership..."
|
||||
git_command push origin main
|
||||
|
||||
# Delete the specified branch locally and remotely
|
||||
print_message "Time to clean up our space debris..."
|
||||
git_command branch -d "$BRANCH_NAME"
|
||||
git_command push origin --delete "$BRANCH_NAME"
|
||||
|
||||
# Run git status
|
||||
print_message "And now, the final systems check..."
|
||||
git_command status
|
||||
|
||||
print_message "Mission accomplished! You're clear for your next adventure, Space Cowboy! 🌠"
|
||||
'';
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
{ writeShellApplication, ffmpeg-full, ... }:
|
||||
|
||||
# Some useful resources for this undocumented shit:
|
||||
# - https://stackoverflow.com/q/59056863/55246
|
||||
# - https://gist.github.com/nikhan/26ddd9c4e99bbf209dd7
|
||||
writeShellApplication {
|
||||
name = "twitter-convert";
|
||||
runtimeInputs = [ ffmpeg-full ];
|
||||
meta.description = ''
|
||||
Convert a video for uploading to X / Twitter.
|
||||
|
||||
You may need a Basic or Premium tier to upload longer videos.
|
||||
'';
|
||||
text = ''
|
||||
export ARSCRIPT="${./ffmpeg_ar}"
|
||||
${./ffmpeg_twitter} "$1"
|
||||
'';
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
#!/bin/bash
|
||||
eval $(ffprobe -v error -show_entries stream=width,height -of default=noprint_wrappers=1 "$1")
|
||||
#results in e.g.
|
||||
#width=300
|
||||
#height=1200
|
||||
echo "height=$height"$'\n'"width=$width"
|
||||
newenv=$(bc <<< "width=$width; height=$height;"$'\nscale=3; aspect=width / height;\nprint "aspect=", aspect;
|
||||
print "''\n'$'";\n\nif (aspect>3) { r=(height) * (aspect/3); print "height=";}
|
||||
if (aspect<(1/3)) {r=(width) / (aspect/(1/3)); print "width=";}\nscale=0
|
||||
if (r) { print r/1 }')
|
||||
[ ! -z "$newenv" ] && echo "$newenv" && export $newenv
|
||||
echo "aspect=""$(bc <<< "scale=3; $width/$height")"
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -xe
|
||||
|
||||
export $($ARSCRIPT "$1")
|
||||
ffmpeg -i "$1" \
|
||||
-filter_complex 'fps=30,format=yuv420p,pad='"ceil($width/2)*2:ceil($height/2)*2"':(ow-iw)/2:(oh-ih)/2' -c:v h264_videotoolbox -c:a aac -ac 2 -ar 44100 -r 30 \
|
||||
output.mp4
|
||||
Loading…
Add table
Add a link
Reference in a new issue