Skip to content

Instantly share code, notes, and snippets.

View gerardsimons's full-sized avatar

Gerard gerardsimons

View GitHub Profile
@gerardsimons
gerardsimons / telegram_notify_fish
Created March 15, 2024 04:27
Telegram notification
function telegram_notify
set encoded_text (python -c "import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))" "$argv")
curl "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage?chat_id=$TELEGRAM_BOT_CHANNEL&text=$encoded_text"
end
@gerardsimons
gerardsimons / pip-commands.bash
Created August 18, 2023 09:57
Useful pip commands
# Uninstall all packages
pip uninstall -y (pip freeze)
@gerardsimons
gerardsimons / pip_uninstall_all.sh
Created February 1, 2023 13:15
Uninstall all pip packages
pip freeze | xargs -I {} pip uninstall -y {}
@gerardsimons
gerardsimons / main.dart
Created April 6, 2022 10:40
firstWhere example
class Item {
final int i;
final bool show;
Item(this.i, this.show);
String toString() {
return 'Item i=$i show=$show';
}
<?php
$output = shell_exec('hostname');
echo "<pre>$output</pre>";
?>
#!/bin/bash
hostname
" Took most of this from here https://realpython.com/vim-and-python-a-match-made-in-heaven/#macos-os-x
set shell=/bin/bash
" https://realpython.com/vim-and-python-a-match-made-in-heaven/#vundle "
set nocompatible " required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
@gerardsimons
gerardsimons / main.dart
Created February 25, 2021 13:43
dynamic getters for class based on Map and noSuchMethod
class QueryMap<T> {
Map<String,T> _data;
QueryMap(Map<String,T> data) {
_data = Map<String,T>();
data.forEach((k, v) => _data[new Symbol(k).toString()] = v);
}
dynamic noSuchMethod(Invocation invocation) {