Skip to content

Instantly share code, notes, and snippets.

@kidpixo
kidpixo / PostGIS 2.0 Cheatsheet.md
Last active Jun 19, 2021
PostGIS 2.0 Cheatsheet
View PostGIS 2.0 Cheatsheet.md
@kidpixo
kidpixo / jupyter_shortcuts.md
Last active Jun 18, 2021
Keyboard shortcuts for ipython notebook 3.1.0 / jupyter
View jupyter_shortcuts.md

Warning This is SEVERELY outdated, the current jupyter version is > 6.X, please refer to your current jupyter notebook installation!

Disclaimer : I just copied those shortcuts from Jupyter Menú > Help > Keyboard Shortcuts, I didn't wrote them myself.

Check your current shortcuts in your Help, shortcuts coule have been modified by extensions or your past self.

Toc

Keyboard shortcuts

@kidpixo
kidpixo / zathura_history_rofi.sh
Last active Mar 4, 2021
Open file from zathura history with rofi, checking if files exist. (Bash>=4.4 for array functions)
View zathura_history_rofi.sh
#!/bin/sh
# see https://unix.stackexchange.com/questions/467524/open-file-from-history-in-zathura
# save filepaths in history to array, reverse order
readarray -t Data < <(grep -o '/.*\.[[:alpha:]]\{,3\}' ~/.local/share/zathura/history | tac)
# loop and unset not existing files
for i in "${!Data[@]}"
do
if ! [ -e "${Data[$i]}" ]; then
View bashrc.sh
alias ..='cd ..'
alias ...='cd ../../../'
################################################
# [bash - aliasing cd to pushd - is it a good idea? - Unix & Linux Stack Exchange](https://unix.stackexchange.com/a/4291/187865)
# You can then navigate around on the command-line a bit like a browser.
# - cd changes the directory.
# - back goes to the previous directory that you cded from.
# - flip will move between the current and previous directories without popping them from the directory stack.
View 10-terminal-commands-to-speed-up-macos-sierra-on-your-mac.sh
# from : 10 terminal commands to speed up your Mac | defaults-write.com
# https://www.defaults-write.com/10-terminal-commands-to-speed-up-macos-sierra-on-your-mac/
#1. Disable animations when opening and closing windows.
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
#2. Disable animations when opening a Quick Look window.
defaults write -g QLPanelAnimationDuration -float 0
#3. Accelerated playback when adjusting the window size (Cocoa applications).
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
#4. Disable animation when opening the Info window in Finder (cmd⌘ + i).
defaults write com.apple.finder DisableAllAnimations -bool true
View weresync_automate.sh
# weresync backup
#
# autobackup on disk connect via udev rules :
# - [How to Auto Backup Files to USB Media When Connected](https://www.tecmint.com/auto-backup-files-to-usb-media-in-linux/)
# - [udev - ArchWiki](https://wiki.archlinux.org/index.php/udev)
# - [[SOLVED] automatic usb-backup with udev-rules + script / Newbie Corner / Arch Linux Forums](https://bbs.archlinux.org/viewtopic.php?id=32639)
# udevadm info -a -n sda > disk info
stop_weresync(){
WSPID=$(sudo pgrep weresync-daemon)
View sklearn_classes_sort.py
# this code rearrange numeric labels based on an input array.
# I normally use some feature of the input data.
# X is the data matrix as pandas.Dataframe
# X.shape : [ROWS, COLUMNS]
# get the k labels
n_clusters=k
k_means = cluster.KMeans(n_clusters=n_clusters, random_state=0).fit(scaler.transform(X))
labels = k_means.labels_
@kidpixo
kidpixo / postgresql90.md
Created May 21, 2013
PostgreSQL 9.0 cheatsheet from www.postgresonline.com
View postgresql90.md