Giter Club home page Giter Club logo

bin's Introduction

Useful scripts for Linux users

See my Fish config for more CLI awesomness


Decription

Some handy bash aliases and settings

Usage

  1. wget https://raw.githubusercontent.com/dmi3/bin/aliases.bash --no-check-certificate -O ~/bin/aliases.bash
  2. echo "source ~/bin/aliases.bash" >> ~/.bashrc
  3. To make bash more usable you probably want to install https://github.com/mrzool/bash-sensible
  4. To make this work across remote machines, you also may want to install https://github.com/Russell91/sshrc

Decription

  • Backup secrets from www.protectedtext.com to local storage
  • If file is changed, keep previous version with date postfix
  • Only backups once per day
  • Can be decrypted using base64 -d BACKUP_FILE | openssl aes-256-cbc -d -k PASSWORD
  • More info http://developer.run/13

Usage

Run from commandline or add to cron


Decription

Renames files given in arguments. Interactively prompts for file name. If no otherwise specified - uses first file name + number.

Usage

rename.py file1 file2 file3 ...


Description

One more script to show battery status as bar(s). Difference from other solutions:

  • Simplicity, duh
  • Acknowledges the fact that there were sometimes more than one battery in laptop
    • Will display capacity for all batteries
  • Also the fact that there were sometimes no battery at all!
    • No error in this case
  • Old batteries usually max at ≈99, so it has same symbol as 100
  • Can work with indicator-sysmonitor
  • Spark could be used here, but this solution is even simpler

Usage

$ battery # multiple batteries are installed
🔌 ▄▇
$ battery # single battery is installed
🔌 ▇
$ battery # no battery is installed
🔌

Decription

Script for quickly adding and accessing bookmarks. Browser independent. When you want to store bookmarks in plain format, use CLI, but don't want use bm or Buku Useful when set by hotkeys or ClipIt actions.

Requirements

  1. sudo apt-get install fzf

Usage

  • bookmarks -a http://github.com useful site
  • bookmarks -a %s $(zenity --entry) Interactive
  • bookmarks
  • Bookmark currently copied link using ClipIt actions: bookmarks -a %s $(zenity --entry)

Config for ClipIt with sane defaults and hotheys


Fish config with awesome flexible prompt, unicode symbols, better fzf integration and tons of handy functions.


Config for Kitty with custom hotkeys, nicer color scheme and some useful tweaks Refer to original documentation for more options


Config for LXTerminal with copy/paste on Ctrl+C/V and nicer color theme


Description

GUI LXQT Settings menu

Requirements

 fzf

Usage

control-panel

Decription

Ping https://healthchecks.io/ on successful Duplicati backup

Usage

Add path to this script to run-script-after in job ConfigurationOptionsAdvanched Options On Windows you will need to create .bat file containing path to this script, and add path to .bat file to run-script-after


Decription

  • Writes all running AWS EC2 instances with defined name to SSH config file
  • So you write ssh instance_name instead of ssh -i ~/.ssh/gate.pem [email protected]
  • Autocompletion!
  • Command history is clean and reusable for ssh and scp
  • Instance IP change on reboot is not problem anymore
  • Works well with sssh2.

Instalation

Usage

  • If you have Openssh > 7.3:
  • Else (will overwrite file)
    • ec2ssh.sh | tee ~/.ssh/config

Export playlists from Spotify without giving credentials to shady sites (to avoid your Spotify credentials be stolen and resold to someone in different timezone)

Converts Spotify playlist from "Song Links" list:

https://open.spotify.com/track/6autdCG3xl7gzoiDCEB2HN
https://open.spotify.com/track/4q6RvRkXquQ965hubV58lb
https://open.spotify.com/track/01pzLOA8rQLfoodUCLc2wj

To "Track - Artist" list:

Nerevar Rising - Jeremy Soule
Arcanum - NewEnglandStringQuartet
Wilderness - Matt Uelmen    

Requirements

sudo apt-get install jq

Usage

  1. Open Spotify app
  2. Open playlist or "Songs" view
  3. Select all tracks Ctrl+A
  4. Copy track urls Ctrl+C
  5. Paste into file and save
  6. cat /path/to/file | ex-spotify-playlist.sh

Decription

Generates this readme

Usage

 echo -e "#!/bin/sh\necho \# Useful scripts for Linux users > README.md\necho \"See my [Fish config](https://github.com/dmi3/fish) for more CLI awesomness\" >> README.md\ngenerate-readme.fish >> README.md\nshasum -a 256 * | grep -v 'SHASUMS\|config' > SHASUMS" > .git/hooks/pre-commit
 chmod +x .git/hooks/pre-commit    

Decription

Script to simply sync all changes into git repository with one command. For example publish local changes to Github.

Requirements

  1. sudo apt-get install git
  2. Setup mergetool

Usage

git-sync /path/to/repo
git-sync # current dir
git-sync # if you want sync all files
git-sync -u # if you want only sync files explicitly added via `git add filename`

Description

  • Prints ground shaking headlines from Hacker News in shell greeting
  • Don't miss next Meltdown, be notified right away!
  • Doesn't distract you if nothing important happened
  • Allows open all news in browser and mark it as read
  • If you prefer simpler version without additional functionality refer to initial version
  • See http://developer.run/27 for description and more ideas

Requirements

sudo apt-get install jq

Usage

  • headlines.sh will print latest headlines
  • headlines.sh read will open all news in browser and mark it as read (hide)
    • ~/.readnews stores titles and urls of read news
    • ~/.readnews might be useful if you want to find article later
    • ~/.readnews might be synced between computers
  • headlines.sh clear will mark all news as read (hide)
  • Add to shell greeting see screenshot

Decription

Mounts USB device, syncs new podcast in gpodder then umounts device

Requirements

  1. sudo apt-get install python3 id3v2
  2. wget https://raw.github.com/dmi3/bin/master/notify-append -P ~/bin && chmod +x ~/bin/notify-append

Usage

  1. set LABEL to label of your player filesystem (for example SANSA CLIP to find label type ls -l /dev/disk/by-label/)
  2. set GPODDER_DIR to directory where gpodder download podcasts
  3. run itunec when you want to sync or
  4. gpodder -> Podcasts -> Prefences -> Devices; set Device type to Filesystem-based and Mountpoint path where device is mounted by default
  5. gpodder -> Podcasts -> Prefences -> Edit config -> cmd_all_download_complete -> itunec

Decription

Knocks to given ports with 0.5 second delay. Useful when default knockd delay is to short for server to react. Additionally displays Gun's N' Roses lyrics :)

Requirements

  1. sudo apt-get install knockd python3 python3-setuptools
  2. sudo easy_install3 sh

Usage

knock ip [port,port...]


Decription

Prints free memory in gigabytes. Sends urgent notification if usage is less than defined value. Cached memory is considered free. Works best with indicator-sysmonitor and dunst

Requirements

  1. sudo apt-get install notify-send

Decription

Setups MUS (Minimal Usable System). Targets very slow machines with very broken disks and very bad internet, so checks everything.

Usage

/usr/bin/GET https://raw.githubusercontent.com/dmi3/bin/master/mus.sh > ~/mus.sh && chmod +x ~/mus.sh && ~/mus.sh

Decription

Font especially designed to fit 6 digits to 20x8 screens For some reason miniwi.flf figlet font is not working in tty Useful for Raspberry Pi 2fa

    ▐ ██ ██ ▌▐ ██ ██
    ▐  ▐  ▐ ▌▐ ▌  ▌
    ▐ ██ ██ ██ ██ ██
    ▐ ▌   ▐  ▐  ▐ ▌▐
    ▐ ██ ██  ▐ ██ ██

Usage

python3 numbers.py 123456

Description

Interactive (un)mount of hotplug devices (USB drives) from console using FZF!

Requirements

  1. sudo apt-get install jq fzf udisks2

Usage

$ plug
>         ACRONIS_MED     DataTraveler_2.0        sdb1     
          DATA            DataTraveler_3.0        sdc1
Mounted /dev/sdb1 at /media/dmi3/ACRONIS_MED.
$ plug -u
> /media/dmi3/ACRONIS_MED ACRONIS_MED     DataTraveler_2.0                sdb1                                                                                                                          
  /                       workbuntu2020   Samsung_SSD_860_EVO_M.2_500GB   sda2                                                                                                                                  
  /media/dmi3/ElTorito    ElTorito        Samsung_SSD_860_EVO_M.2_500GB   sda1 
Unmounted /dev/sdb1 
alias unplug='plug -u'

Decription

Gracefully closes all running X applications, then powers off the computer. Useful to avoid issues when calling poweroff from console:

  • "The database you are trying to open is locked by another instance of KeePassXC.",
  • "Well, this is embarrassing. Firefox is having trouble recovering your windows and tabs."
  • Spotify forgetting current playlist
  • etc

Requirements

  1. sudo apt-get install wmctrl

Decription

Script to run append Skype messages in Notify OSD as shown on http://thexnews.com/uploads/notify.gif Since x-canonical-append is broken in notify-send for example in Skype you will wait forever untill all messages are shown This script makes new messages readable in same notification window Readme in russian

Requirements

wget https://raw.github.com/dmi3/bin/master/notify-append -P ~/bin && chmod +x ~/bin/notify-append

Usage

skypenotify "%sname" "%smessage"


Decription

System wide text snippet expander. Simulates cut→replace→paste so works in almost any application. Examples:

  • Type ->, press hotkey, get .
  • Type thx, press hotkey, get Thank you. Original idea by sessy and Linux Magazine with following improvements:
  • Works as keybinding in Compiz/Unity/Openbox
  • Does not go crazy if keybinding includes Ctrl, Alt, Shift...
  • Works in Sublime Text/IntelliJ Idea/Chrome/Slack
  • Expands snippets without preceding space i.e. 30eur to 30€
    • If snippet needs preceding space or start of line - use regexp \b i.e. s/\bv$/✔/g; converts v to only if its separate symbol
  • Expands snippets with symbols i.e. -> to
  • Expands commands i.e. now to formatted todays date, mon to to formatted next mondays date
  • Stores all snippets in one file
  • Works with Ubuntu 16.04

Requirements

sudo apt-get install xdotool xclip xsel

Usage

  • Bind script to hotkey in your DE, for example Shift+Tab.
  • Add new snippets after line 30, in format s/SHORCUT$/REPLACEMENT/g;

Decription

Script to change your terminal title to user@host when connecting to ssh and changing it back after exiting. Additionally sets green prompt on remote host. Useful for Keepassx and visual distinction to avoid notorious "wrong window" problem. Also works when connecting Fish → Bash If you want hostname from local ~/.ssh/config file to appear in title use sssh2.

Requirements

sudo apt-get install xdotool

Usage

sssh user@hostname alias ssh=sssh


Decription

Like sssh, in addition:

  • hostname parameter of ssh command will appear in title.
    • Useful when calling by nickname from local ~/.ssh/config i.e. ssh server_nickname, and change of server hostname is not an option.
  • If command supports tunneling, display it in title
    • I.e. ssh -L 80:localhost:80 server_nickname will set title user@[80]server_nickname
    • Avoid accidental closing of such tabs
  • Appends some useful aliases to existing ~/.bashrc
  • Preserves command history on multiple sessions

Usage

See sssh


Description

Status

CLI Status dashboard. Visualizes GitHub and Twitter followers, and last 500 blog hits. Works well in addition to headlines.sh and newsbeuter -x reload -x print-unread 2> /dev/null Read more

Requirements

  • spark
  • sudo apt-get install jq

Usage

  • status.sh

Decription

Simple timer with sound and dialog window notification. To remind you to turn stove off :). Replace pc_up.wav to any available audiofile.

Requirements

sudo apt-get install dunst aplay

Usage

timer 6 # i.e. notify after 6 minutes

Wunderlist CLI for adding todos

Decription

Wrapper for wl for adding todos with more convenient syntax Read More

Instalation

  1. ⚠ Make sure Fish shell > 2.3.0
  2. curl https://raw.githubusercontent.com/dmi3/bin/master/todo --create-dirs -o ~/bin/todo
  3. curl https://raw.githubusercontent.com/dmi3/bin/master/config/fish/completions/todo.fish --create-dirs -o ~/.config/fish/completions/todo.fish
  4. https://developer.wunderlist.com/apps
  5. [CREATE APP] (Put https://wunderlist.com to both APP URL and AUTH CALLBACK URL)
  6. Set enviroment variables in this script ↓ (line 31)
  7. Add more list shortcuts ↓ (line 39)

Usage

 todo buy stuff --life --on next monday
 todo resolve issue --work --star
 todo --work meet customer --on jan 7

  * Simple Hackable Pomodoro Timer with optional Slack and Habitica integrations. * Intended to be hacked and modified to fit your specific vision of how Pomodoro timers should work. * Moved to [separate repo](https://github.com/dmi3/tomatych)

Decription

Show popup with translation of selected text. Works in any application.

Requirements

  1. Setup https://github.com/dmi3/bin/blob/master/yandex-translate.sh
  2. sudo apt-get install zenity xsel

Usage

  • Bind script to hotkey in your DE.
  • Select any text. Press hotkey.

Decription

CLI Yandex Translate API ru↔en. Automatically detects language. Translates any language to Russian, and Russian to English.

Usage

yandex-translate.sh cat is a small, typically furry, carnivorous mammal # en → ru
yandex-translate.sh die Hauskatze ist eine Unterart der Wildkatze # de → ru
yandex-translate.sh кот это маленькое, пушистое и очень хитрое млекопитающее # ru → en

Decription

Prompts for text. Then inputs translation. Works in any application.

Requirements

  1. Setup https://github.com/dmi3/bin/blob/master/yandex-translate.sh
  2. sudo apt-get install zenity xsel

Usage

  • Bind script to hotkey in your DE. After input wait couple of seconds for translation to appear.

Decription

Update tray icon depending on script result. Current example shows unread mail count for Evolution mail (for those poor souls who need exchange but don't have web client), but actually in can check and notify about literally anything! Read more:

Requirements

  1. sudo apt-get install yad
  2. For Evolution sudo apt-get install sqlite3

Usage

tray-unread.sh
  • `on_exit() {

Decription

Script to control audio volume from console, hotkeys, e.t.c. Also shows nice Notify OSD buble with current volume value

Requirements

sudo apt-get install pulseaudio notify-osd

Usage

volume (up|down|mute)

Description

Using Wolfram Alpha in command line. See for description and more ideas.

Requirements

You can use text only api and optionaly use terminal that supports images or sudo apt-get install imagemagick to view images

Usage

➤ wa helsinki to dublin plane
2 hours 20 minutes                                                                                           
➤ wa time in dublin
5:37:57 pm GMT; Friday, January 27, 2017
➤ wa 15.36 english money to eur
14.35 euros                                                                                                          
➤ wa days till nov 16
293 days
➤ wa 154Mbit/s to MB/s
19.2 megabytes per second
➤ wa brick red hex
#AB0303 
➤ wa weather in moscow
9 degrees Celsius and cloudy, with light winds✖
➤ wa plot x=y^2
[...draws plot if supported]
➤ # many many more usages... https://www.wolframalpha.com/examples/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.