diff options
| author | Vito Graffagnino <vito@graffagnino.xyz> | 2020-09-08 18:10:49 +0100 |
|---|---|---|
| committer | Vito Graffagnino <vito@graffagnino.xyz> | 2020-09-08 18:10:49 +0100 |
| commit | 3b0142cedcde39e4c2097ecd916a870a3ced5ec6 (patch) | |
| tree | 2116c49a845dfc0945778f2aa3e2118d72be428b /.cheat | |
| parent | 8cc927e930d5b6aafe3e9862a61e81705479a1b4 (diff) | |
Added the relevent parts of the .config directory. Alss add ssh config
Diffstat (limited to '.cheat')
| -rwxr-xr-x | .cheat/adb | 19 | ||||
| -rw-r--r-- | .cheat/cheat/.nmcli.swp | bin | 0 -> 12288 bytes | |||
| -rw-r--r-- | .cheat/cheat/conda | 84 | ||||
| -rw-r--r-- | .cheat/cheat/i3 | 92 | ||||
| -rw-r--r-- | .cheat/cheat/luna | 234 | ||||
| -rw-r--r-- | .cheat/cheat/nmcli | 52 | ||||
| -rw-r--r-- | .cheat/cheat/sed | 17 | ||||
| -rw-r--r-- | .cheat/cheat/ssh | 53 | ||||
| -rw-r--r-- | .cheat/cheat/w3mtips | 34 | ||||
| -rw-r--r-- | .cheat/cheat/weechat | 17 | ||||
| -rw-r--r-- | .cheat/cheat/youtube-dl | 20 | ||||
| -rwxr-xr-x | .cheat/conda | 84 | ||||
| -rw-r--r-- | .cheat/dvdlinux | 28 | ||||
| -rw-r--r-- | .cheat/gpg | 173 | ||||
| -rwxr-xr-x | .cheat/i3 | 92 | ||||
| -rwxr-xr-x | .cheat/luna | 236 | ||||
| -rwxr-xr-x | .cheat/nmcli | 52 | ||||
| -rwxr-xr-x | .cheat/sed | 17 | ||||
| -rwxr-xr-x | .cheat/ssh | 34 | ||||
| -rwxr-xr-x | .cheat/w3mtips | 34 | ||||
| -rwxr-xr-x | .cheat/weechat | 25 | ||||
| -rwxr-xr-x | .cheat/youtube-dl | 20 | ||||
| -rw-r--r-- | .cheat/yum | 261 |
23 files changed, 1678 insertions, 0 deletions
diff --git a/.cheat/adb b/.cheat/adb new file mode 100755 index 0000000..e75da67 --- /dev/null +++ b/.cheat/adb @@ -0,0 +1,19 @@ +# show a list of devices +adb devices + +#display realtime log of your device +adb logcat -v long > logcat.txt + +#install app +adb install /path/to/apk/file + + +# get directory listing +adb shell 'ls /sdcard/directory' + +# pulling +adb pull /path/to/be/pulled/from /path/to/be/pulled/to + + +# pushing +adb push /path/to/be/pushed/from /path/to/be/pushed/to diff --git a/.cheat/cheat/.nmcli.swp b/.cheat/cheat/.nmcli.swp Binary files differnew file mode 100644 index 0000000..6365447 --- /dev/null +++ b/.cheat/cheat/.nmcli.swp diff --git a/.cheat/cheat/conda b/.cheat/cheat/conda new file mode 100644 index 0000000..e0df93f --- /dev/null +++ b/.cheat/cheat/conda @@ -0,0 +1,84 @@ +# Managing Conda/Anaconda +# ======================= +conda info verify conda is installed, check version # + +conda update conda Update conda package and environment manager + +conda update anaconda Update anaconda meta package + +# Managing Environments +# ===================== +conda info --envsi Get a list of environments, active + or environment shown with * +conda info -e + +conda create --name snowflakes biopython Create an environment and install + or program(s) +conda create -n snowflakes biopython + +source activate snowflakes Activate the new enviroment to use it + +conda create -n bunnies python=3.4 astroid Create new environment and specify python version + +conda create -n flowers --clone snowflakes make exact copy of environment + +conda remove -n flowers --all delete an environment + +conda env export > puppies.yml save current environment to a file + +conda env create -f puppies.yml load environment from file + +# Managing Python +# =============== +conda search --full-name python Check versions of python available to install + or +conda search -f python + +conda create -n snakes python=3.4 Install different version of Python in new environment + +# Managing Conda .condarc configuration +# ===================================== +conda config --get Get all keys and values from my .condarc file + +conda config --get channels Get value of the key channels from .condarc file + +conda config --add channels pandas Add a new value to channels so conda looks for + packages in this location. + +# Managing packages, including Python +# =================================== +conda list View list of packages and versions installed in active + environment + +conda search beautiful-soup Search for a package to see if it is available to conda install + +conda install -n bunnies beautiful-soup Install a new package + +conda update beautiful-soup Update a package in the current environment + +conda search --override-channels -c pandas bottleneck Search for a package in a specific location (the + pandas channel on Anaconda.org) + +conda install -c pandas bottleneck Install a package from a specific channel + +conda search --override-channels -c defaults beautiful-soup Search for a package to see if it is available from + the Anaconda repository + +source activate bunnies Activate the environment where you want to +pip install see install a package and install it with pip (included + with Anaconda and Miniconda) + +conda install iopro accelerate Install commercial Continuum packages + +conda skeleton pypi pyinstrument Build a Conda package from a Python Package Index +conda build pyinstrument (PyPI) Package + +# Removing packages, environments or channels +# =========================================== +conda remove --name bunnies beautiful-soup Remove one package from any named environment + +conda remove beautiful-soup Remove one package from the active environment + +conda remove --name bunnies beautiful-soup astroid Remove multiple packages from any environment + +conda remove --name snakes --all Remove an environment diff --git a/.cheat/cheat/i3 b/.cheat/cheat/i3 new file mode 100644 index 0000000..edec20a --- /dev/null +++ b/.cheat/cheat/i3 @@ -0,0 +1,92 @@ +##################################################### +# +# --- Key Bindings List --- {{{ +# +##################################################### +# +# $mod+{} +# ======= +# $mod+a focus parent +# $mod+b split h +# $mod+d exec --no-startup-id dmenu_run +# $mod+e exec --no-startup-id $term -e "mutt -F ~/.muttrc" +# $mod+f fullscreen toggle +# $mod+h focus left +# $mod+j focus down +# $mod+k focus up +# $mod+l focus right +# $mod+m exec --no-startup-id /usr/bin/mplayer +# $mod+n border normal +# $mod+r exec --no-startup-id $term -e ranger +# $mod+t layout toggle split +# $mod+u border none +# $mod+v split v +# $mod+w exec --no-startup-id $browser +# $mod+y border pixel 2 +# $mod+z split v, layout stacking +# $mod+space focus mode_toggle +# $mod+Return exec --no-startup-id +# $mod+grave exec --no-startup-id $HOME/bin/scripts/any_term_dropdown.sh +# $mod+F11 exec --no-startup-id amixer set Master 5%- +# $mod+F12 exec --no-startup-id amixer set Master 5%+ +# $mod+F1 exec --no-startup-id xbacklight -dec 5 +# $mod+F2 exec --no-startup-id xbacklight -inc 5 +# $mod+F4 mode "$mode_system" +# +# ======= +# $mod+Shift+{} +# ======= +# $mod+Shift+c reload +# $mod+Shift+d exec --no-startup-id rofi -show run -lines 10 -eh 2 -width 80 \ +# -padding $(($(xwininfo -root | awk '/Height/ {print $2}')/4)) \ +# -opacity "75" -bw 0 -bc "$base02" -bg "$base02" -fg "$base03" \ +# -hlbg "$base02" -hlfg "#9575cd" -font "System San Francisco Display 12" +# $mod+Shift+e exec --no-startup-id "i3-nagbar -t warning -m 'You pressed the exit shortcut.\ +# Do you really want to exit i3? This will end your X session.' -b \ +# 'Yes, exit i3' 'i3-msg exit'" +# $mod+Shift+f exec --no-startup-id /usr/bin/firefox -no-remote -P default +# $mod+Shift+h move left +# $mod+Shift+i exec --no-startup-id /usr/bin/firefox -no-remote -P Jupyter +# $mod+Shift+j move down +# $mod+Shift+k move up +# $mod+Shift+l move right +# $mod+Shift+m exec --no-startup-id /usr/bin/mpv +# $mod+Shift+n exec --no-startup-id /usr/bin/nm-applet +# $mod+Shift+q kill +# $mod+Shift+r restart +# $mod+Shift+t exec --no-startup-id /usr/bin/firefox -private-window -no-remote -P Torrent +# $mod+Shift+u resize shrink height 10 px or 10 ppt +# $mod+Shift+w exec --no-startup-id /usr/local/bin/eclipse/eclipse +# $mod+Shift+y exec --no-startup-id /usr/bin/firefox -no-remote -P Youtube +# $mod+Shift+space floating toggle +# $mod+Shift+Return exec --no-startup-id $term -e tmux +# +# ======= +# $mod+Ctrl+{} +# ======= +# $mod+Ctrl+r mode "resize" +# $mod+Ctrl+d gaps inner current set 0; gaps outer current set 0 +# $mod+Ctrl+t gaps inner current set 15; gaps outer current set 15 + +# $mod+Ctrl+i resize grow height 10 px or 10 ppt +# $mod+Ctrl+o resize grow width 10 px or 10 ppt +# $mod+Ctrl+u resize shrink height 10 px or 10 ppt +# $mod+Ctrl+y resize shrink width 10 px or 10ppt + +# $mod+Ctrl+h gaps inner current plus 5 +# $mod+Ctrl+j gaps outer current minus 5 +# $mod+Ctrl+k gaps outer current plus 5 +# $mod+Ctrl+l gaps inner current minus 5 +# $mod+Ctrl+space exec --no-startup-id $HOME/bin/scripts/rofi-scripts-collection/rofi-bangs.sh \ +# -font "System San Francisco Display 12" +# $mod+Ctrl+Return exec --no-startup-id guake +# +# ======= + + +##################################################### +# +# --- }}} +# +##################################################### + diff --git a/.cheat/cheat/luna b/.cheat/cheat/luna new file mode 100644 index 0000000..c19eae5 --- /dev/null +++ b/.cheat/cheat/luna @@ -0,0 +1,234 @@ +#Connect to any (known) WAP in range (or simply turn on WiFi): + +luna-send -n 1 palm://com.palm.wifi/setstate '{"state":"enabled"}' +luna-send -n 1 palm://com.palm.wifi/findnetworks '{""}' + + +#Disconnect from WiFi: + +luna-send -n 1 palm://com.palm.wifi/setstate '{"state":"disabled"}' + +#Turn Bluetooth ON: + +luna-send -n 1 palm://com.palm.btmonitor/monitor/radioon '{"visible":true, "connectable":true}' + +#Turn Bluetooth OFF: + +luna-send -n 1 palm://com.palm.btmonitor/monitor/radiooff {} + +#Using luna-send to refresh the Launcher panel. + +luna-send -n 1 palm://com.palm.applicationManager/rescan {} + + +#Get a list of all installed apps: + +luna-send -n 1 "palm://com.palm.applicationManager/listLaunchPoints" "{}" + + +#Using luna-send to launch an application: + +luna-send -n 1 palm://com.palm.applicationManager/launch {\"id\":\"com.palm.app.browser\"} +luna-send -n 1 palm://com.palm.applicationManager/launch {\"id\":\"com.palm.app.browser\",\"params\":{\"scene\":\"page\",\"target\":\"http://www.google.com\"}} + + +#Using luna-send to download a file to /media/internal/downloads/: + +luna-send -n 1 palm://com.palm.downloadmanager/download {\"target\":\"http://www.google.com/index.html\"} + + +#Using luna-send to first import and then set the wallpaper image: + +luna-send -n 1 palm://com.palm.systemservice/wallpaper/importWallpaper {"target": "/media/internal/wallpapers/your_file.jpg" } +luna-send -n 1 palm://com.palm.systemservice/setPreferences {"wallpaper": {"wallpaperName": "your_file.jpg", "wallpaperFile": "/media/internal/wallpapers/your_file.jpg"}} + + + +#Using luna-send to control the palm progress animation (The pulsing "palm" logo seen at boot): + +luna-send -n 1 palm://com.palm.systemmanager/runProgressAnimation {\"state\":\"start\"} +luna-send -n 1 palm://com.palm.systemmanager/runProgressAnimation {\"state\":\"stop\"} + +#TODO: These should probably be plugged into the Tracker app. + + +luna-send -n 1 palm://com.palm.location/setUseGps {\"useGps\":\"true\"} +luna-send -n 1 palm://com.palm.location/setAutoLocate {\"autoLocate\":\"true\"} +luna-send -n 1 palm://com.palm.location/getCurrentPosition {} + + +#List all of the processes which are running: + +sudo luna-send -n 1 palm://com.palm.applicationManager/running {} +** Message: serviceResponse Handling: 2, { "running": [ { "id": "com.palm.launcher", "processid": "1006" }, { "id": "com.palm.systemui", "processid": "1007" }, { "id": "com.palm.app.email", "processid": "1000" }, { "id": "com.palm.app.phone", "processid": "1001" }, { "id": "com.palm.app.contacts", "processid": "1002" }, { "id": "com.palm.app.camera", "processid": "1003" }, { "id": "com.palm.app.messaging", "processid": "1004" }, { "id": "com.palm.app.calendar", "processid": "1005" }, { "id": "com.palm.app.phone", "processid": "1008" }, { "id": "com.palm.app.camera", "processid": "1014" } ] } + + +#Close a process: + +luna-send -n 1 "palm://com.palm.applicationManager/close" "{\"processId\":\"1058\"}" + + +#Activate the vibrator: + +luna-send -n 1 palm://com.palm.vibrate/vibrate {\"period\":1,\"duration\":1000\} + +#The duration value is in milliseconds and can be adjusted as desired. + + +#Photos Info - list album and image from mediadb.db3: + +luna-send -n 1 luna://com.palm.mediadb/image/listalbums {} + +luna-send -n 1 luna://com.palm.mediadb/image/listimages {} + + +#Set system volume - "volume" range is 0-100 + +luna-send -n 1 palm://com.palm.audio/system/setVolume '{"volume":80}' + + +#Set media volume - "volume" range is 0-100 + +luna-send -n 1 palm://com.palm.audio/media/setVolume '{"volume":80}' + + +#Set ringtone volume - "volume" range is 0-100 + +luna-send -n 1 palm://com.palm.audio/ringtone/setVolume '{"volume":100}' + + +#Dial a number - this actually calls the number, not just setup + +luna-send -n 1 palm://com.palm.telephony/dial '{"number":"8001234567"}' + + + +#Hang up a phone call :-) There are ways to end specific types of calls but I think this is good enough for now. Let me know if you want the other methods. + +luna-send -n 1 palm://com.palm.telephony/hangupAll {} + + +#Send a text message - only need to change phone "value" and "messageText" + +luna-send -n 1 palm://com.palm.messaging/sendMessageFromCompose '{"recipientJSONArray": [{"lastName": "", "pictureLoc": "", "contactCount": 1, "displayText": "", "firstName": "", "pictureLocBig": "", "imAvailability": 6, "pictureLocSquare": "", "contactDisplay": "", "Person_id": "", "personId": "", "type": "phone", "value": "8165551234", "alreadyValidated": true, "prefix": "to$A", "identifier": ""}], "messageText": "Content of message here"}' + + +#set phone to no roam (home network only) + +luna-send -n 1 palm://com.palm.telephony//roamModeSet '{"mode":"homeonly"}' + + +#set phone to auto roam + +luna-send -n 1 palm://com.palm.telephony//roamModeSet '{"mode":"any"}' + + +#set phone to roam only + +luna-send -n 1 palm://com.palm.telephony//roamModeSet '{"mode":"roamonly"}' + + +#Applications + +#Notes (view notes): + +luna-send -n 1 palm://com.palm.notes/getNotes {} + + +#Storage + +#Enter usb storage mode: + +luna-send -n 1 palm://com.palm.storage/diskmode/enterMSM {\"user-confirmed\":true,\"enterIMasq\":false} + + +#Exit usb storage mode (toggle): + +luna-send -n 1 palm://com.palm.storage/diskmode/enterMSM {\"user-confirmed\":true,\"enterIMasq\":false} + +#Airplane Mode + +#Enable Airplane Mode: + +luna-send -n 1 palm://com.palm.systemservice/setPreferences '{"airplaneMode":true}' + + +#Disable Airplane Mode: + +luna-send -n 1 palm://com.palm.systemservice/setPreferences '{"airplaneMode":false}' + +# Fix messaging thread problem (from Grabber5.0 +# http://forums.webosnation.com/palm-pre-2/272900-sms-issue-messages-can-no-longer-displayed-conversation.html) + +"The hardest part is tracking down the person id if you have a lot of contacts. + +You have to get the id of the chat thread and the person, using Impostah. +The easiest thing to do is save the object to a file while viewing it in Impostah +(you will prob have to change the filename, as the display name for the chat thread +and person id are likely the same, and that is what is used for the default filename. +I prefixed the chat thread filename with "chatthread"). Finding the person id can take +a while if you have a lot of contacts. + +Then run this command, filling in the chat thread id and person id. +The phone# is probably not required, but I supplied it anyway, just copying the value from the chat thread." + + +#Person object and chatthread object saved from Impostah so we can grab the chatthread id +#and person id for the merge command. +# +##Update chat thread person id and locked flag. Reply address prob not necessary (it is not changing) + +luna-send -n 1 -a com.palm.app.messaging luna://com.palm.db/merge ' +{"objects":[{"_id":"XXXXXXXX","personId":"XXXXXXX","flags":{"locked":false},"replyAddress":"(999) 555-1212"}]}' + +# +#Get chatthread to confirm changes. +# + +luna-send -n 1 -a com.palm.app.messaging luna://com.palm.db/get '{"ids":["XXXXXXXX"]}' + + +# Use palm-install to install ipk +Usage: palm-install [OPTION...] [PACKAGE | APP_ID] +Install or remove applications from a HP webOS device. + +Options: +-d, --device=DEVICE Specify DEVICE to use + --device-list List the available devices +-l, --list List the installed applications +-r, --remove Remove applications instead of installing +--version Display version info and exit +--help Display this help and exit + +PACKAGE is the file path of the package to install, +e.g. ~/projects/packages/com.example.app_1.0_all.ipk. + +APP_ID is the id of the application to remove. + +DEVICE is a unique identifier which matches a device name, type, or id +(as returned by the device-list option). e.g. Use "usb" for a usb-connected +device, or "tcp" for an emulator (note: emulator must be running). If not +specified, the first device found is used. + +# Install package +palm-install ~/projects/packages/com.example.app_1.0_all.ipk + +# Remove application +palm-install -r com.example.app + +# List applications on default device +palm-install -l + +# List applications on usb device +palm-install -d usb -l + +# List applications on emulator +palm-install -d tcp -l + +# Make apps fit the whole screen Pre3 +# transfer metadata.json to the folder of each application not working correctly +# +# /media/cryptofs/apps/usr/palm/applications/(whatever app) +# +# metadata.json can be found at /MacOSX-Data1/Computing/Palm/webos/Archive/games patch/metadata.json + diff --git a/.cheat/cheat/nmcli b/.cheat/cheat/nmcli new file mode 100644 index 0000000..cd38bf4 --- /dev/null +++ b/.cheat/cheat/nmcli @@ -0,0 +1,52 @@ +# Desc: Command line interface to NetworkManager + +# Connect to a wireless access point - Parameters: +# <wiface> -- the name of your wireless interface +# <ssid> -- the SSID of the access point +# <pass> -- the WiFi password +nmcli d wifi connect <ssid> password <pass> iface <wiface> + +# Disconnect from WiFi - Parameters: +# <wiface> -- the name of your wireless interface +nmcli d wifi disconnect iface <wiface> + +# Get WiFi status (enabled / disabled) +nmcli radio wifi + +# Enable / Disable WiFi +nmcli radio wifi <on|off> + +# Show all available WiFi access points +nmcli dev wifi list + +# Refresh the available WiFi connection list +nmcli dev wifi rescan + +# Show all available connections +nmcli con + +# Show only active connections +nmcli con show --active + +# Review the available devices +nmcli dev status + +# Add a dynamic ethernet connection - parameters: +# <name> -- the name of the connection +# <iface_name> -- the name of the interface +ncmli con add type ethernet con-name <name> ifname <iface_name> + +# Bring up the ethernet connection +nmcli con up <name> + +# Bring Wifi radio up, connect to SSID, switch on vpn +nmcli radio wifi on +nmcli con up <SSID> +vpn_<loc>_up + + +# Switch off vpn, disconnect from SSID, bring Wifi radio down +vpn_<loc>_dn +nmcli con down <SSID> +nmcli radio wifi off + diff --git a/.cheat/cheat/sed b/.cheat/cheat/sed new file mode 100644 index 0000000..e22c97a --- /dev/null +++ b/.cheat/cheat/sed @@ -0,0 +1,17 @@ +# To replace all occurrences of "day" with "night" and write to stdout: +sed 's/day/night/g' file.txt + +# To replace all occurrences of "day" with "night" within file.txt: +sed -i 's/day/night/g' file.txt + +# To replace all occurrences of "day" with "night" on stdin: +echo 'It is daytime' | sed 's/day/night/g' + +# To remove leading spaces +sed -i -r 's/^\s+//g' file.txt + +# To remove empty lines and print results to stdout: +sed '/^$/d' file.txt + +# To replace newlines in multiple lines +sed ':a;N;$!ba;s/\n//g' file.txt diff --git a/.cheat/cheat/ssh b/.cheat/cheat/ssh new file mode 100644 index 0000000..e4087a9 --- /dev/null +++ b/.cheat/cheat/ssh @@ -0,0 +1,53 @@ +# To ssh via pem file (which normally needs 0600 permissions): +ssh -i /path/to/file.pem user@example.com + +# To connect on an non-standard port: +ssh -p 2222 user@example.com + +# To connect and forward the authentication agent +ssh -A user@example.com + +# To execute a command on a remote server: +ssh -t user@example.com 'the-remote-command' + +# To tunnel an x session over SSH: +ssh -X user@example.com + +# Redirect traffic with a tunnel between local host (port 8080) and a remote +# host (remote.example.com:5000) through a proxy (personal.server.com): +ssh -f -L 8080:remote.example.com:5000 user@personal.server.com -N + +# To launch a specific x application over SSH: +ssh -X -t user@example.com 'chromium-browser' + +# To create a SOCKS proxy on localhost and port 9999 +ssh -D 9999 user@example.com + +# -X use an xsession, -C compress data, "-c blowfish" use the encryption blowfish +ssh user@example.com -C -c blowfish -X + +# For more information, see: +# http://unix.stackexchange.com/q/12755/44856 + +# Copy files and folders through ssh from remote host to pwd with tar.gz compression +# when there is no rsync command available +ssh user@example.com "cd /var/www/Shared/; tar zcf - asset1 asset2" | tar zxf - + +# Set up SSH Passwordless login using ssh keygen +# +# 1. On client, generate public/private keys + +ssh-keygen -t rsa + +# 2. Login to server and make sure that a .ssh directory exists in user's home directory. Create it otherwise. +# +# 3. Use ssh from client to upload the public key to the server, and place it in the users's .ssh directory and call it authorized_keys + +[user@client]$ cat .ssh/id_rsa.pub | ssh user@server 'cat >> .ssh/authorized_keys' + +# 4. Set Permissions on server + +[user@client]$ ssh user@server 'chmod 700 .ssh; chmod 640 .ssh/authorized_keys' + +# 5. Can now login to server with the use of password. + diff --git a/.cheat/cheat/w3mtips b/.cheat/cheat/w3mtips new file mode 100644 index 0000000..eb1b027 --- /dev/null +++ b/.cheat/cheat/w3mtips @@ -0,0 +1,34 @@ +# The list of external browsers assigned to w3m are as follows: +# +#extbrowser /home/opensuse/vgg/anaconda3/bin/qutebrowser +#extbrowser2 bash -c 'transmission-remote -a "$0" && notify-send -t 3000 -i emblem-downloads "Adding Torrent" "$0" ' +#extbrowser3 bash -c 'echo -n "$0" | xclip -selection clipboard && notify-send -t 3000 -i edit-copy "W3M URL Yank To Clipboard" "$0"' +#extbrowser4 bash -c 'TS_SOCKET=/tmp/ytdl ts /home/opensuse/vgg/anaconda3/bin/youtube-dl "$0" && notify-send -t 3000 -i package-x-generic "youtube-dl: Downloading" "$0" ' +#extbrowser5 bash -c 'TS_SOCKET=/tmp/w3m ts /usr/bin/aria2c -j 1 -c -d $HOME/Downloads "$0" && notify-send -t 3000 -i package-x-generic "Aria2c: Downloading" "$0" ' +#extbrowser6 bash -c 'TS_SOCKET=/tmp/mpv ts /usr/bin/mpv --ontop --force-window --autofit=500x200 --geometry=-15-50 "$0" && notify-send -t 3000 -i video-x-generic "MPV Queue" "$0"' +#extbrowser7 /usr/bin/firefox +# +# To browse current document using external browsers, use the following Key bindings: + +# For external browser (i.e. qutebrowser see above list) +M + +# to send torrent link to transmission-remote +2M + +# to copy hyperlink to clipboard +3M + +# to download link via youtube-dl +4M + +# to download link via aria +5M + +# to send link to mpv +6M + +# or via firefox +7M + +To browse the link using external browsers, prefix the above key bindings with the ESC key. diff --git a/.cheat/cheat/weechat b/.cheat/cheat/weechat new file mode 100644 index 0000000..869ca07 --- /dev/null +++ b/.cheat/cheat/weechat @@ -0,0 +1,17 @@ +# Set unread marker on all windows +Ctrl-s Ctrl-u + +# Switch buffer left +Ctrl-p, Alt-left +# Switch buffer right +Ctrl-n, Alt-right +# Next buffer with activity +Alt-a +# Switch buffers +#Alt-0...9 +Ctrl-x + +# Scroll buffer title +F9/F10 +# Scroll nick list +F11/F12 diff --git a/.cheat/cheat/youtube-dl b/.cheat/cheat/youtube-dl new file mode 100644 index 0000000..2ff3536 --- /dev/null +++ b/.cheat/cheat/youtube-dl @@ -0,0 +1,20 @@ +# To download a video in 720p MP4: +youtube-dl -f 22 example.com/watch?v=id + +# To download a video in 720p MP4 or WebM or FLV: +youtube-dl -f 22/45/120 + +# To list all available formats of a video: +youtube-dl -F example.com/watch?v=id + +# To download a video to /$uploader/$date/$title.$ext: +youtube-dl -o '%(uploader)s/%(date)s/%(title)s.%(ext)s' example.com/watch?v=id + +# To download a video playlist starting from a certain video: +youtube-dl --playlist-start 5 example.com/watch?v=id&list=listid + +# To simulate a download with youtube-dl: +youtube-dl -s example.com/watch?v=id + +# For all video formats see +# http://en.wikipedia.org/wiki/YouTube#Quality_and_codecs diff --git a/.cheat/conda b/.cheat/conda new file mode 100755 index 0000000..6959e6b --- /dev/null +++ b/.cheat/conda @@ -0,0 +1,84 @@ +Managing Conda/Anaconda +======================= +conda info verify conda is installed, check version # + +conda update conda Update conda package and environment manager + +conda update anaconda Update anaconda meta package + +Managing Environments +===================== +conda info --envsi Get a list of environments, active + or environment shown with * +conda info -e + +conda create --name snowflakes biopython Create an environment and install + or program(s) +conda create -n snowflakes biopython + +source activate snowflakes Activate the new enviroment to use it + +conda create -n bunnies python=3.4 astroid Create new environment and specify python version + +conda create -n flowers --clone snowflakes make exact copy of environment + +conda remove -n flowers --all delete an environment + +conda env export > puppies.yml save current environment to a file + +conda env create -f puppies.yml load environment from file + +Managing Python +=============== +conda search --full-name python Check versions of python available to install + or +conda search -f python + +conda create -n snakes python=3.4 Install different version of Python in new environment + +Managing Conda .condarc configuration +===================================== +conda config --get Get all keys and values from my .condarc file + +conda config --get channels Get value of the key channels from .condarc file + +conda config --add channels pandas Add a new value to channels so conda looks for + packages in this location. + +Managing packages, including Python +=================================== +conda list View list of packages and versions installed in active + environment + +conda search beautiful-soup Search for a package to see if it is available to conda install + +conda install -n bunnies beautiful-soup Install a new package + +conda update beautiful-soup Update a package in the current environment + +conda search --override-channels -c pandas bottleneck Search for a package in a specific location (the + pandas channel on Anaconda.org) + +conda install -c pandas bottleneck Install a package from a specific channel + +conda search --override-channels -c defaults beautiful-soup Search for a package to see if it is available from + the Anaconda repository + +source activate bunnies Activate the environment where you want to +pip install see install a package and install it with pip (included + with Anaconda and Miniconda) + +conda install iopro accelerate Install commercial Continuum packages + +conda skeleton pypi pyinstrument Build a Conda package from a Python Package Index +conda build pyinstrument (PyPI) Package + +Removing packages, environments or channels +=========================================== +conda remove --name bunnies beautiful-soup Remove one package from any named environment + +conda remove beautiful-soup Remove one package from the active environment + +conda remove --name bunnies beautiful-soup astroid Remove multiple packages from any environment + +conda remove --name snakes --all Remove an environment diff --git a/.cheat/dvdlinux b/.cheat/dvdlinux new file mode 100644 index 0000000..fbccb6b --- /dev/null +++ b/.cheat/dvdlinux @@ -0,0 +1,28 @@ +Make sure the following are installed: + +ffmpeg, dvdauthor, genisoimage, growisofs, dvd+rw-tools + +enter the following: + +$ export VIDEO_FORMAT=PAL # This is used later when the DVD is being authored. + +now need to convert the video file into mpg format: + +$ ffmpeg -i yourfile.mkv -target pal-dvd -aspect 16:9 yournewfile.mpg + +Now we can use dvdauthor + +$ mkdir DVD +$ dvdauthor -o DVD -t yournewfile.mpg # -o defines the output folder, -t defines the title file. + # Repeat this for as many files as you want on the dvd. +$ dvdauthor -i DVD -T # This defines the TOC. + +We are now ready to convert the DVD to an iso to burn + +genisoimage -dvd-video -o yourimage.iso + +Once this is ready to burn can use k3b or on the command line use: + +$ growisofs -dvd-compat -Z /dev/sr0=yourimage.iso + +Ref: https://www.linux.com/blog/how-convert-video-file-iso-burn-dvd diff --git a/.cheat/gpg b/.cheat/gpg new file mode 100644 index 0000000..8bc5b42 --- /dev/null +++ b/.cheat/gpg @@ -0,0 +1,173 @@ +# Create a key + + gpg --gen-key + + +# Show keys + + To list a summary of all keys + + gpg --list-keys + + To show your public key + + gpg --armor --export + + To show the fingerprint for a key + + gpg --fingerprint KEY_ID + +# Search for keys + + gpg --search-keys 'user@emailaddress.com' + + +# To Encrypt a File + + gpg --encrypt --recipient 'user@emailaddress.com' example.txt + + +# To Decrypt a File + + gpg --output example.txt --decrypt example.txt.gpg + + +# Export keys + + gpg --output ~/public_key.txt --armor --export KEY_ID + gpg --output ~/private_key.txt --armor --export-secret-key KEY_ID + + Where KEY_ID is the 8 character GPG key ID. + + Store these files to a safe location, such as a USB drive, then + remove the private key file. + + shred -zu ~/private_key.txt + +# Import keys + + Retrieve the key files which you previously exported. + + gpg --import ~/public_key.txt + gpg --allow-secret-key-import --import ~/private_key.txt + + Then delete the private key file. + + shred -zu ~/private_key.txt + +# Revoke a key + + Create a revocation certificate. + + gpg --output ~/revoke.asc --gen-revoke KEY_ID + + Where KEY_ID is the 8 character GPG key ID. + + After creating the certificate import it. + + gpg --import ~/revoke.asc + + Then ensure that key servers know about the revokation. + + gpg --send-keys KEY_ID + +# Signing and Verifying files + + If youre uploading files to launchpad you may also want to include + a GPG signature file. + + gpg -ba filename + + or if you need to specify a particular key: + + gpg --default-key <key ID> -ba filename + + This then produces a file with a .asc extension which can be uploaded. + If you need to set the default key more permanently then edit the + file ~/.gnupg/gpg.conf and set the default-key parameter. + + To verify a downloaded file using its signature file. + + gpg --verify filename.asc + +# Signing Public Keys + + Import the public key or retrieve it from a server. + + gpg --keyserver <keyserver> --recv-keys <Key_ID> + + Check its fingerprint against any previously stated value. + + gpg --fingerprint <Key_ID> + + Sign the key. + + gpg --sign-key <Key_ID> + + Upload the signed key to a server. + + gpg --keyserver <keyserver> --send-key <Key_ID> + +# Change the email address associated with a GPG key + + gpg --edit-key <key ID> + adduid + + Enter the new name and email address. You can then list the addresses with: + + list + + If you want to delete a previous email address first select it: + + uid <list number> + + Then delete it with: + + deluid + + To finish type: + + save + + Publish the key to a server: + + gpg --send-keys <key ID> + +# Creating Subkeys + + Subkeys can be useful if you don't wish to have your main GPG key + installed on multiple machines. In this way you can keep your + master key safe and have subkeys with expiry periods or which may be + separately revoked installed on various machines. This avoids + generating entirely separate keys and so breaking any web of trust + which has been established. + + gpg --edit-key <key ID> + + At the prompt type: + + addkey + + Choose RSA (sign only), 4096 bits and select an expiry period. + Entropy will be gathered. + + At the prompt type: + + save + + You can also repeat the procedure, but selecting RSA (encrypt only). + To remove the master key, leaving only the subkey/s in place: + + gpg --export-secret-subkeys <subkey ID> > subkeys + gpg --export <key ID> > pubkeys + gpg --delete-secret-key <key ID> + + Import the keys back. + + gpg --import pubkeys subkeys + + Verify the import. + + gpg -K + + Should show sec# instead of just sec. diff --git a/.cheat/i3 b/.cheat/i3 new file mode 100755 index 0000000..edec20a --- /dev/null +++ b/.cheat/i3 @@ -0,0 +1,92 @@ +##################################################### +# +# --- Key Bindings List --- {{{ +# +##################################################### +# +# $mod+{} +# ======= +# $mod+a focus parent +# $mod+b split h +# $mod+d exec --no-startup-id dmenu_run +# $mod+e exec --no-startup-id $term -e "mutt -F ~/.muttrc" +# $mod+f fullscreen toggle +# $mod+h focus left +# $mod+j focus down +# $mod+k focus up +# $mod+l focus right +# $mod+m exec --no-startup-id /usr/bin/mplayer +# $mod+n border normal +# $mod+r exec --no-startup-id $term -e ranger +# $mod+t layout toggle split +# $mod+u border none +# $mod+v split v +# $mod+w exec --no-startup-id $browser +# $mod+y border pixel 2 +# $mod+z split v, layout stacking +# $mod+space focus mode_toggle +# $mod+Return exec --no-startup-id +# $mod+grave exec --no-startup-id $HOME/bin/scripts/any_term_dropdown.sh +# $mod+F11 exec --no-startup-id amixer set Master 5%- +# $mod+F12 exec --no-startup-id amixer set Master 5%+ +# $mod+F1 exec --no-startup-id xbacklight -dec 5 +# $mod+F2 exec --no-startup-id xbacklight -inc 5 +# $mod+F4 mode "$mode_system" +# +# ======= +# $mod+Shift+{} +# ======= +# $mod+Shift+c reload +# $mod+Shift+d exec --no-startup-id rofi -show run -lines 10 -eh 2 -width 80 \ +# -padding $(($(xwininfo -root | awk '/Height/ {print $2}')/4)) \ +# -opacity "75" -bw 0 -bc "$base02" -bg "$base02" -fg "$base03" \ +# -hlbg "$base02" -hlfg "#9575cd" -font "System San Francisco Display 12" +# $mod+Shift+e exec --no-startup-id "i3-nagbar -t warning -m 'You pressed the exit shortcut.\ +# Do you really want to exit i3? This will end your X session.' -b \ +# 'Yes, exit i3' 'i3-msg exit'" +# $mod+Shift+f exec --no-startup-id /usr/bin/firefox -no-remote -P default +# $mod+Shift+h move left +# $mod+Shift+i exec --no-startup-id /usr/bin/firefox -no-remote -P Jupyter +# $mod+Shift+j move down +# $mod+Shift+k move up +# $mod+Shift+l move right +# $mod+Shift+m exec --no-startup-id /usr/bin/mpv +# $mod+Shift+n exec --no-startup-id /usr/bin/nm-applet +# $mod+Shift+q kill +# $mod+Shift+r restart +# $mod+Shift+t exec --no-startup-id /usr/bin/firefox -private-window -no-remote -P Torrent +# $mod+Shift+u resize shrink height 10 px or 10 ppt +# $mod+Shift+w exec --no-startup-id /usr/local/bin/eclipse/eclipse +# $mod+Shift+y exec --no-startup-id /usr/bin/firefox -no-remote -P Youtube +# $mod+Shift+space floating toggle +# $mod+Shift+Return exec --no-startup-id $term -e tmux +# +# ======= +# $mod+Ctrl+{} +# ======= +# $mod+Ctrl+r mode "resize" +# $mod+Ctrl+d gaps inner current set 0; gaps outer current set 0 +# $mod+Ctrl+t gaps inner current set 15; gaps outer current set 15 + +# $mod+Ctrl+i resize grow height 10 px or 10 ppt +# $mod+Ctrl+o resize grow width 10 px or 10 ppt +# $mod+Ctrl+u resize shrink height 10 px or 10 ppt +# $mod+Ctrl+y resize shrink width 10 px or 10ppt + +# $mod+Ctrl+h gaps inner current plus 5 +# $mod+Ctrl+j gaps outer current minus 5 +# $mod+Ctrl+k gaps outer current plus 5 +# $mod+Ctrl+l gaps inner current minus 5 +# $mod+Ctrl+space exec --no-startup-id $HOME/bin/scripts/rofi-scripts-collection/rofi-bangs.sh \ +# -font "System San Francisco Display 12" +# $mod+Ctrl+Return exec --no-startup-id guake +# +# ======= + + +##################################################### +# +# --- }}} +# +##################################################### + diff --git a/.cheat/luna b/.cheat/luna new file mode 100755 index 0000000..9980219 --- /dev/null +++ b/.cheat/luna @@ -0,0 +1,236 @@ +#Connect to any (known) WAP in range (or simply turn on WiFi): + +luna-send -n 1 palm://com.palm.wifi/setstate '{"state":"enabled"}' +luna-send -n 1 palm://com.palm.wifi/findnetworks '{""}' + + +#Disconnect from WiFi: + +luna-send -n 1 palm://com.palm.wifi/setstate '{"state":"disabled"}' + +#Turn Bluetooth ON: + +luna-send -n 1 palm://com.palm.btmonitor/monitor/radioon '{"visible":true, "connectable":true}' + +#Turn Bluetooth OFF: + +luna-send -n 1 palm://com.palm.btmonitor/monitor/radiooff {} + +#Using luna-send to refresh the Launcher panel. + +luna-send -n 1 palm://com.palm.applicationManager/rescan {} + + +#Get a list of all installed apps: + +luna-send -n 1 "palm://com.palm.applicationManager/listLaunchPoints" "{}" + + +#Using luna-send to launch an application: + +luna-send -n 1 palm://com.palm.applicationManager/launch {\"id\":\"com.palm.app.browser\"} +luna-send -n 1 palm://com.palm.applicationManager/launch {\"id\":\"com.palm.app.browser\",\"params\":{\"scene\":\"page\",\"target\":\"http://www.google.com\"}} + + +#Using luna-send to download a file to /media/internal/downloads/: + +luna-send -n 1 palm://com.palm.downloadmanager/download {\"target\":\"http://www.google.com/index.html\"} + + +#Using luna-send to first import and then set the wallpaper image: + +luna-send -n 1 palm://com.palm.systemservice/wallpaper/importWallpaper {"target": "/media/internal/wallpapers/your_file.jpg" } +luna-send -n 1 palm://com.palm.systemservice/setPreferences {"wallpaper": {"wallpaperName": "your_file.jpg", "wallpaperFile": "/media/internal/wallpapers/your_file.jpg"}} + + + +#Using luna-send to control the palm progress animation (The pulsing "palm" logo seen at boot): + +luna-send -n 1 palm://com.palm.systemmanager/runProgressAnimation {\"state\":\"start\"} +luna-send -n 1 palm://com.palm.systemmanager/runProgressAnimation {\"state\":\"stop\"} + +#TODO: These should probably be plugged into the Tracker app. + + +luna-send -n 1 palm://com.palm.location/setUseGps {\"useGps\":\"true\"} +luna-send -n 1 palm://com.palm.location/setAutoLocate {\"autoLocate\":\"true\"} +luna-send -n 1 palm://com.palm.location/getCurrentPosition {} + + +#List all of the processes which are running: + +sudo luna-send -n 1 palm://com.palm.applicationManager/running {} +** Message: serviceResponse Handling: 2, { "running": [ { "id": "com.palm.launcher", "processid": "1006" }, { "id": "com.palm.systemui", "processid": "1007" }, { "id": "com.palm.app.email", "processid": "1000" }, { "id": "com.palm.app.phone", "processid": "1001" }, { "id": "com.palm.app.contacts", "processid": "1002" }, { "id": "com.palm.app.camera", "processid": "1003" }, { "id": "com.palm.app.messaging", "processid": "1004" }, { "id": "com.palm.app.calendar", "processid": "1005" }, { "id": "com.palm.app.phone", "processid": "1008" }, { "id": "com.palm.app.camera", "processid": "1014" } ] } + + +#Close a process: + +luna-send -n 1 "palm://com.palm.applicationManager/close" "{\"processId\":\"1058\"}" + + +#Activate the vibrator: + +luna-send -n 1 palm://com.palm.vibrate/vibrate {\"period\":1,\"duration\":1000\} + +#The duration value is in milliseconds and can be adjusted as desired. + + +#Photos Info - list album and image from mediadb.db3: + +luna-send -n 1 luna://com.palm.mediadb/image/listalbums {} + +luna-send -n 1 luna://com.palm.mediadb/image/listimages {} + + +#Set system volume - "volume" range is 0-100 + +luna-send -n 1 palm://com.palm.audio/system/setVolume '{"volume":80}' + + +#Set media volume - "volume" range is 0-100 + +luna-send -n 1 palm://com.palm.audio/media/setVolume '{"volume":80}' + + +#Set ringtone volume - "volume" range is 0-100 + +luna-send -n 1 palm://com.palm.audio/ringtone/setVolume '{"volume":100}' + + +#Dial a number - this actually calls the number, not just setup + +luna-send -n 1 palm://com.palm.telephony/dial '{"number":"8001234567"}' + + + +#Hang up a phone call :-) There are ways to end specific types of calls but I think this is good enough for now. Let me know if you want the other methods. + +luna-send -n 1 palm://com.palm.telephony/hangupAll {} + + +#Send a text message - only need to change phone "value" and "messageText" + +luna-send -n 1 palm://com.palm.messaging/sendMessageFromCompose '{"recipientJSONArray": [{"lastName": "", "pictureLoc": "", "contactCount": 1, "displayText": "", "firstName": "", "pictureLocBig": "", "imAvailability": 6, "pictureLocSquare": "", "contactDisplay": "", "Person_id": "", "personId": "", "type": "phone", "value": "8165551234", "alreadyValidated": true, "prefix": "to$A", "identifier": ""}], "messageText": "Content of message here"}' + + +#set phone to no roam (home network only) + +luna-send -n 1 palm://com.palm.telephony//roamModeSet '{"mode":"homeonly"}' + + +#set phone to auto roam + +luna-send -n 1 palm://com.palm.telephony//roamModeSet '{"mode":"any"}' + + +#set phone to roam only + +luna-send -n 1 palm://com.palm.telephony//roamModeSet '{"mode":"roamonly"}' + + +#Applications + +#Notes (view notes): + +luna-send -n 1 palm://com.palm.notes/getNotes {} + + +#Storage + +#Enter usb storage mode: + +luna-send -n 1 palm://com.palm.storage/diskmode/enterMSM {\"user-confirmed\":true,\"enterIMasq\":false} + + +#Exit usb storage mode (toggle): + +luna-send -n 1 palm://com.palm.storage/diskmode/enterMSM {\"user-confirmed\":true,\"enterIMasq\":false} + +#Airplane Mode + +#Enable Airplane Mode: + +luna-send -n 1 palm://com.palm.systemservice/setPreferences '{"airplaneMode":true}' + + +#Disable Airplane Mode: + +luna-send -n 1 palm://com.palm.systemservice/setPreferences '{"airplaneMode":false}' + +# Fix messaging thread problem (from Grabber5.0 +# http://forums.webosnation.com/palm-pre-2/272900-sms-issue-messages-can-no-longer-displayed-conversation.html) + +"The hardest part is tracking down the person id if you have a lot of contacts. + +You have to get the id of the chat thread and the person, using Impostah. +The easiest thing to do is save the object to a file while viewing it in Impostah +(you will prob have to change the filename, as the display name for the chat thread +and person id are likely the same, and that is what is used for the default filename. +I prefixed the chat thread filename with "chatthread"). Finding the person id can take +a while if you have a lot of contacts. + +Then run this command, filling in the chat thread id and person id. +The phone# is probably not required, but I supplied it anyway, just copying the value from the chat thread." + + +#Person object and chatthread object saved from Impostah so we can grab the chatthread id +#and person id for the merge command. +# +##Update chat thread person id and locked flag. Reply address prob not necessary (it is not changing) + +luna-send -n 1 -a com.palm.app.messaging luna://com.palm.db/merge ' +{"objects":[{"_id":"XXXXXXXX","personId":"XXXXXXX","flags":{"locked":false},"replyAddress":"(999) 555-1212"}]}' + +# +#Get chatthread to confirm changes. +# + +luna-send -n 1 -a com.palm.app.messaging luna://com.palm.db/get '{"ids":["XXXXXXXX"]}' + + +# Use palm-install to install ipk +Usage: palm-install [OPTION...] [PACKAGE | APP_ID] +Install or remove applications from a HP webOS device. + +Options: +-d, --device=DEVICE Specify DEVICE to use + --device-list List the available devices +-l, --list List the installed applications +-r, --remove Remove applications instead of installing +--version Display version info and exit +--help Display this help and exit + +PACKAGE is the file path of the package to install, +e.g. ~/projects/packages/com.example.app_1.0_all.ipk. + +APP_ID is the id of the application to remove. + +DEVICE is a unique identifier which matches a device name, type, or id +(as returned by the device-list option). e.g. Use "usb" for a usb-connected +device, or "tcp" for an emulator (note: emulator must be running). If not +specified, the first device found is used. + +# Install package +palm-install ~/projects/packages/com.example.app_1.0_all.ipk + +# Remove application +palm-install -r com.example.app + +# List applications on default device +palm-install -l + +# List applications on usb device +palm-install -d usb -l + +# List applications on emulator +palm-install -d tcp -l + +# Make apps fit the whole screen Pre3 +# transfer metadata.json to the folder of each application not working correctly +# +# /media/cryptofs/apps/usr/palm/applications/(whatever app) +# +# metadata.json can be found at /MacOSX-Data1/Computing/Palm/webos/Archive/games patch/metadata.json + +# Place Pre3 in recovery mode. +Reboot with letter R pressed, and the pre3 will reboot into recovery mode. Can then connect to USB to doctor. diff --git a/.cheat/nmcli b/.cheat/nmcli new file mode 100755 index 0000000..cd38bf4 --- /dev/null +++ b/.cheat/nmcli @@ -0,0 +1,52 @@ +# Desc: Command line interface to NetworkManager + +# Connect to a wireless access point - Parameters: +# <wiface> -- the name of your wireless interface +# <ssid> -- the SSID of the access point +# <pass> -- the WiFi password +nmcli d wifi connect <ssid> password <pass> iface <wiface> + +# Disconnect from WiFi - Parameters: +# <wiface> -- the name of your wireless interface +nmcli d wifi disconnect iface <wiface> + +# Get WiFi status (enabled / disabled) +nmcli radio wifi + +# Enable / Disable WiFi +nmcli radio wifi <on|off> + +# Show all available WiFi access points +nmcli dev wifi list + +# Refresh the available WiFi connection list +nmcli dev wifi rescan + +# Show all available connections +nmcli con + +# Show only active connections +nmcli con show --active + +# Review the available devices +nmcli dev status + +# Add a dynamic ethernet connection - parameters: +# <name> -- the name of the connection +# <iface_name> -- the name of the interface +ncmli con add type ethernet con-name <name> ifname <iface_name> + +# Bring up the ethernet connection +nmcli con up <name> + +# Bring Wifi radio up, connect to SSID, switch on vpn +nmcli radio wifi on +nmcli con up <SSID> +vpn_<loc>_up + + +# Switch off vpn, disconnect from SSID, bring Wifi radio down +vpn_<loc>_dn +nmcli con down <SSID> +nmcli radio wifi off + diff --git a/.cheat/sed b/.cheat/sed new file mode 100755 index 0000000..e22c97a --- /dev/null +++ b/.cheat/sed @@ -0,0 +1,17 @@ +# To replace all occurrences of "day" with "night" and write to stdout: +sed 's/day/night/g' file.txt + +# To replace all occurrences of "day" with "night" within file.txt: +sed -i 's/day/night/g' file.txt + +# To replace all occurrences of "day" with "night" on stdin: +echo 'It is daytime' | sed 's/day/night/g' + +# To remove leading spaces +sed -i -r 's/^\s+//g' file.txt + +# To remove empty lines and print results to stdout: +sed '/^$/d' file.txt + +# To replace newlines in multiple lines +sed ':a;N;$!ba;s/\n//g' file.txt diff --git a/.cheat/ssh b/.cheat/ssh new file mode 100755 index 0000000..e83bcce --- /dev/null +++ b/.cheat/ssh @@ -0,0 +1,34 @@ +# To ssh via pem file (which normally needs 0600 permissions): +ssh -i /path/to/file.pem user@example.com + +# To connect on an non-standard port: +ssh -p 2222 user@example.com + +# To connect and forward the authentication agent +ssh -A user@example.com + +# To execute a command on a remote server: +ssh -t user@example.com 'the-remote-command' + +# To tunnel an x session over SSH: +ssh -X user@example.com + +# Redirect traffic with a tunnel between local host (port 8080) and a remote +# host (remote.example.com:5000) through a proxy (personal.server.com): +ssh -f -L 8080:remote.example.com:5000 user@personal.server.com -N + +# To launch a specific x application over SSH: +ssh -X -t user@example.com 'chromium-browser' + +# To create a SOCKS proxy on localhost and port 9999 +ssh -D 9999 user@example.com + +# -X use an xsession, -C compress data, "-c blowfish" use the encryption blowfish +ssh user@example.com -C -c blowfish -X + +# For more information, see: +# http://unix.stackexchange.com/q/12755/44856 + +# Copy files and folders through ssh from remote host to pwd with tar.gz compression +# when there is no rsync command available +ssh user@example.com "cd /var/www/Shared/; tar zcf - asset1 asset2" | tar zxf - diff --git a/.cheat/w3mtips b/.cheat/w3mtips new file mode 100755 index 0000000..6fa4536 --- /dev/null +++ b/.cheat/w3mtips @@ -0,0 +1,34 @@ +# The list of external browsers assigned to w3m are as follows: +# +#extbrowser ${HOME}/anaconda3/bin/qutebrowser +#extbrowser2 bash -c 'transmission-remote -a "$0" && notify-send -t 3000 -i emblem-downloads "Adding Torrent" "$0" ' +#extbrowser3 bash -c 'echo -n "$0" | xclip -selection clipboard && notify-send -t 3000 -i edit-copy "W3M URL Yank To Clipboard" "$0"' +#extbrowser4 bash -c 'TS_SOCKET=/tmp/ytdl ts ${HOME}/anaconda3/bin/youtube-dl "$0" && notify-send -t 3000 -i package-x-generic "youtube-dl: Downloading" "$0" ' +#extbrowser5 bash -c 'TS_SOCKET=/tmp/w3m ts /usr/bin/aria2c -j 1 -c -d $HOME/Downloads "$0" && notify-send -t 3000 -i package-x-generic "Aria2c: Downloading" "$0" ' +#extbrowser6 bash -c 'TS_SOCKET=/tmp/mpv ts /usr/bin/mpv --ontop --force-window --autofit=500x200 --geometry=-15-50 "$0" && notify-send -t 3000 -i video-x-generic "MPV Queue" "$0"' +#extbrowser7 /usr/bin/firefox +# +# To browse current document using external browsers, use the following Key bindings: + +# For external browser (i.e. qutebrowser see above list) +M + +# to send torrent link to transmission-remote +2M + +# to copy hyperlink to clipboard +3M + +# to download link via youtube-dl +4M + +# to download link via aria +5M + +# to send link to mpv +6M + +# or via firefox +7M + +To browse the link using external browsers, prefix the above key bindings with the ESC key. diff --git a/.cheat/weechat b/.cheat/weechat new file mode 100755 index 0000000..06bbe39 --- /dev/null +++ b/.cheat/weechat @@ -0,0 +1,25 @@ +# Set unread marker on all windows +Ctrl-s Ctrl-u + +# Switch buffer left +Ctrl-p, Alt-left +# Switch buffer right +Ctrl-n, Alt-right +# Next buffer with activity +Alt-a +# Switch buffers +#Alt-0...9 +Ctrl-x + +# Scroll buffer title +F9/F10 +# Scroll nick list +F11/F12 +### vimode (https://github.com/GermainZ/weechat-vimode) +/script install vimode.py +# enable vimode status indicator +# /set weechat.bar.input.items "[input_prompt]+(away),[input_search], [input_paste], input_text" +/set weechat.bar.input.items "[mode_indicator]+[input_prompt]+(away),[input_search], [input_paste], input_text,[vi_buffer]" +# show line numbers ( q/Q/m = quote/yank ; use :7 to jump to line 7) +/set weechat.bar.vi_line_numbers.hidden off +/save diff --git a/.cheat/youtube-dl b/.cheat/youtube-dl new file mode 100755 index 0000000..2ff3536 --- /dev/null +++ b/.cheat/youtube-dl @@ -0,0 +1,20 @@ +# To download a video in 720p MP4: +youtube-dl -f 22 example.com/watch?v=id + +# To download a video in 720p MP4 or WebM or FLV: +youtube-dl -f 22/45/120 + +# To list all available formats of a video: +youtube-dl -F example.com/watch?v=id + +# To download a video to /$uploader/$date/$title.$ext: +youtube-dl -o '%(uploader)s/%(date)s/%(title)s.%(ext)s' example.com/watch?v=id + +# To download a video playlist starting from a certain video: +youtube-dl --playlist-start 5 example.com/watch?v=id&list=listid + +# To simulate a download with youtube-dl: +youtube-dl -s example.com/watch?v=id + +# For all video formats see +# http://en.wikipedia.org/wiki/YouTube#Quality_and_codecs diff --git a/.cheat/yum b/.cheat/yum new file mode 100644 index 0000000..c4dc4af --- /dev/null +++ b/.cheat/yum @@ -0,0 +1,261 @@ +#---------------------------------------------- +# +# To install the latest version of a package: + +$ yum install {package-name} + +# +#---------------------------------------------- +# +# To reinstall a package: + +$ yum reinstall {package-name} + +# +#---------------------------------------------- +# +# To perform a local install: + +$ yum localinstall {package-name} + +# +#---------------------------------------------- +# +# To install all updates/patches + +$ yum update + +# +#---------------------------------------------- +# +# To fix an interrupted update + +$ yum-complete-transaction + +# If this doesn't work type in the following: + +$ yum history + +# This will list the yum transactions. A * will indicate an +# interrupted/aborted transaction. Take note of the transaction number, +# then yupe the following: + +$ yum history redo force-reinstall [transaction ID] + +# Alternatively, undo and then redo the transaction as follows: + +$ yum history undo [transaction ID] +$ yum history redo [transaction ID] + +# +#---------------------------------------------- +# +# To install updates for specific package + +$ yum update {package-name} + +# +#---------------------------------------------- +# +# To downgrade a specific package + +$ yum downgrade {package-name} + +# +#---------------------------------------------- +# +# To updates package to specific version. +## First find a list of all duplicates + +$ yum --showduplicates list {package-name} + +## Now update to particular version + +$ yum update-to {package-name}-{version} + +# +#---------------------------------------------- +# +# To display a list of updated software and security fixes + +$ yum list updates + +# +#---------------------------------------------- +# +# To find out whether updates exist for already installed packages + +$ yum check-update + +# +#---------------------------------------------- +# +# To remove a package: + +$ yum remove {package-name} +$ yum erase {package-name} + +# +#---------------------------------------------- +# +# To remove unneeded packages/deps: + +$ yum autoremove + +# +#---------------------------------------------- +# +# To search for a package: + +$ yum search {package-name} + +# +#---------------------------------------------- +# +# To find what package installs a program: + +$ yum whatprovides </path/to/program> + +# +#---------------------------------------------- +# +# To find the dependencies of a package: + +$ yum deplist {package-name} + +# +#---------------------------------------------- +# +# To find information about a package: + +$ yum info {package-name} + +# +#---------------------------------------------- +# +# List all installed packages + +$ yum list installed + +# +#---------------------------------------------- +# +# List packages containing a certain keyword: + +$ yum list <package_name_or_word_to_search> + +# +#---------------------------------------------- +# +# To download the source RPM for a package: + +$ yumdownloader --source {package-name} + +# (You have to install yumdownloader first, which is installed by the yum-utils package) +# +#---------------------------------------------- +# +# Clean Yum Cache + +$ yum clean all + +## To check local rpm database for problems + +$ yum check + +# +#---------------------------------------------- +# +# List currently enabled repositories: + +$ yum repolist + +# +#---------------------------------------------- +# +# To see info about enabled repositories: + +$ yum repoinfo {repo-name} + +# +#---------------------------------------------- +# +# To work with a given repository: + +$ yum repo-pkgs {repo-name} <list|installed|remove|upgrade|reinstall|info> {package-name} + +# +#---------------------------------------------- +# +# To add a yum repo + +$ yum-config-manager --add-repo {repo-url} + +# +#---------------------------------------------- +# +# To enable a yum repo + +$ yum-config-manager --enable {repo-id} + +## use `yum repolist all` to list all repo ids. + +# +#---------------------------------------------- +# +# To disable a yum repo + +$ yum-config-manager --disable {repo-id} + +# +#---------------------------------------------- +# +# To view yum history + +$ yum history + +or + +$ yum history list + +# Lots of things that you can do with this. Checkout +# https://www.cyberciti.biz/faq/yum-history-command/ + +# +#---------------------------------------------- +# +# To list available groups from all yum repos. +# + +$ yum groups list + +or + +$ yum grouplist + +# +#---------------------------------------------- +# +# To view group description/list of packages it contains etc. +# + +$ yum groups info "GROUP NAME" + +# +#---------------------------------------------- +# +# To install a group of packages +# + +$ yum groups install "GROUP NAME" + +# +#---------------------------------------------- +# +# To remove a group of packages +# + +$ yum groups remove "GROUP NAME" + +# +#---------------------------------------------- |
