Created
January 13, 2019 02:27
-
-
Save Lynnesbian/203e2a90a312cd02880f8e5762c01797 to your computer and use it in GitHub Desktop.
my screenshot script(s)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"fmt" | |
"os" | |
"os/exec" | |
"path/filepath" | |
"regexp" | |
) | |
func main() { | |
flag.Parse() | |
upme := flag.Args()[0] | |
if _, err := os.Stat(upme); os.IsNotExist(err) { | |
panic(err) | |
} | |
target := filepath.Base(upme) //get 'wew.png' from '/path/wew.png' | |
//now we have to sanitise the filename | |
regex := regexp.MustCompile(`[&?;/:@={}\[\]"|%^#\\<>\^~ ]`) | |
target = regex.ReplaceAllString(target, "_") | |
tpath := fmt.Sprintf("lynnespace:/var/www/html/res/ceres/%v", target) | |
cmnd := exec.Command("scp", upme, tpath) | |
err := cmnd.Run() | |
if err != nil { | |
panic(err) | |
} | |
fmt.Printf("https://lynnesbian.space/res/ceres/%v", target) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#notify-send -t 3000 "Uploading..." | |
fup "$@" | tee /dev/tty | xclip -selection clipboard | |
play "~/Music/SFX/Pixel 2/Mallet.ogg" &> /dev/null | |
#notify-send -t 3000 "Uploaded, URL copied to clipboard" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fupnme=~/Pictures/Screenshots/$(date +'sshot_%Y-%m-%d_at_%H-%M-%S-%s.png') | |
if maim --nokeyboard --hidecursor "$fupnme"; then | |
play "~/Music/SFX/shutter.mp3" & | |
xclip -selection clipboard -t image/png -i "$fupnme" | |
size=`ls -l "$gupnme" | awk '{print $5}'` | |
if [[ $size -gt 1572864 ]]; then | |
#if file is bigger than 1.5MB | |
gjpg=`echo $fupnme|sed s/\.png/\.jpg/` | |
convert "$fupnme" -quality 85 "$gjpg" | |
rm "$upme" | |
upme=$gjpg | |
fi | |
ect --mt-deflate "$fupnme" | |
fupn "$fupnme" | |
fi | |
wait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fupnme=~/Pictures/Screenshots/$(date +'sshot_%Y-%m-%d_at_%H-%M-%S-%s.png') | |
flameshot gui -r > "$fupnme" | |
ftype=`file -b "$fupnme"` | |
if [ "$ftype" != "ASCII text" ]; then | |
play "~/Music/SFX/shutter.mp3" & | |
xclip -selection clipboard -t image/png -i "$fupnme" | |
ect --mt-deflate "$fupnme" | |
fupn "$fupnme" | |
else | |
rm "$fupnme" | |
fi | |
wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment