Skip to content

Instantly share code, notes, and snippets.

@3ximus
3ximus / rofi-klipper.sh
Last active August 5, 2024 04:30
Rofi + KDE Plasma Klipper for clipboard history selection
#!/bin/bash
clipboard-history(){
for (( i=0; i<20 ; i++ )) ; do
qdbus org.kde.plasmashell /klipper org.kde.klipper.klipper.getClipboardHistoryItem $i | paste -sd ' ' | cut -c1-80
done
}
selected=$(clipboard-history | rofi -dmenu -format i -i -p "clipboard")
if [ $? == 0 ] ; then
@3ximus
3ximus / http-server.py
Last active August 22, 2025 17:14
A better implementation of python's simple http server
#!/bin/env -S python3 -u
# A better implementation of simple http server, it allows for:
# - logging of headers and body content
# - serving files on a directory
# - saving files in body into an output directory
# - serving custom response headers
#
# see usage: http-server.py -h
@3ximus
3ximus / patch-slack-croissantizer.js
Last active September 27, 2023 16:30
Prevent Slack Croissantizer
var originalOpen = originalOpen ? originalOpen : XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function (method, url) {
this._url = url;
return originalOpen.apply(this, arguments);
};
const MESSAGE = [
{
type: "rich_text",
elements: [
@3ximus
3ximus / open_sheets.sh
Last active August 25, 2023 00:00
Upload excel file to google sheets and open it in firefox
#!/bin/bash
# Open an excel file in google sheets
# Reads file contents from stdin. The first argument is the name of the file, if omited 'temp.xlsx' is given
# You'll need to give your own key underneath. If you don't have one just inspect a drive file upload request and get it from there
# NOTE Depends on ./extract_cookies.sh script (https://gist.github.com/hackerb9/d382e09683a52dcac492ebcdaf1b79af)
APIKEY='<your-api-key>'
$(dirname ${BASH_SOURCE[0]})/extract_cookies.sh ~/.mozilla/firefox/*.default-release/cookies.sqlite > /tmp/sheets_upload_cookies.txt
@3ximus
3ximus / install_netcdf_tools.sh
Last active April 28, 2021 15:25
Install script for netcdf with a bunch of dependencies with intel fortran compiler. And ww3 setup.
#!/bin/bash
# vi: foldmethod=marker
# This script install most of the dependencies needed along with intel compiler
# - zlib
# - hdf5
# - netcdf4
# - netcdf4-fortran
# - eccodes
# - cdo