Skip to content

Instantly share code, notes, and snippets.

View dctremblay's full-sized avatar

David Côté-Tremblay dctremblay

View GitHub Profile
@dctremblay
dctremblay / bash-telegram-bot.sh
Last active June 26, 2024 02:29
Bash Telegram Bot : Send and receive messages in realtime (long polling). Shipped with a simple API wrapper. Usage: adapting recvUpdate() and other stuff to your needs.
#!/bin/bash
# Title: Starter Bash Telegram Bot
# Version: 0.1-alpha
# Date: 2024-06-12
# License: Unlicense
# Author: dctremblay@dasio.ca
#
# Telegram Bot API Documentation:
# https://core.telegram.org/bots/api#making-requests
@dctremblay
dctremblay / compress-text.sh
Created June 12, 2024 09:27
near-losslessly compress text from stdin. parameter is nb of runs. using openai chat completions api.
#!/bin/bash
# Title: Compress Text
# Version: 0.1
# Date: 2024-06-12
# License: MIT
# Author: dctremblay@dasio.ca
[ $OPENAI_API_KEY ] || { echo "OPENAI_API_KEY must be set" >&2; exit 1; }
: "${SYSMSG:="You compress the following text"}"
@dctremblay
dctremblay / summarize.sh
Created June 2, 2024 08:02
summarizes text from stdin using openai chat completion api
#!/bin/bash
# Title: summarize.sh
# Version: 0.1
# Date: 2024-06-02
# License: MIT
[ $OPENAI_API_KEY ] || { echo "OPENAI_API_KEY must be set" >&2; exit 1; }
: "${SYSMSG:="You summarize text to make it as short as possible"}"
: "${MODEL:="gpt-3.5-turbo"}"
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="23">
<profile kind="CodeFormatterProfile" name="DASIO" version="23">
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/>
@dctremblay
dctremblay / EXAMPLES.md
Last active May 28, 2024 14:37
quickgpt.sh

In ~/.profile :

alias ask="$HOME/.quickgpt"

alias syn="ask 20 synonyms and their nuances of:"
alias def="ask definition and usage example of:"
alias term="ask 5 most accurate terms and their nuances that describe:"
@dctremblay
dctremblay / bashgpt.sh
Last active May 21, 2024 17:05
BashGPT : Use ChatGPT with Bash and Vim. Conversations are stored and can be continued, markdown is stored as well.
#!/bin/bash
# Title: BashGPT
# Version: 0.1
# Date: 2024-05-21
# License: MIT
# Author: dctremblay@dasio.ca
[ $OPENAI_API_KEY ] || { echo "OPENAI_API_KEY env var must be set" >&2; exit 1; }
gptModel="gpt-4o" #gpt-3.5-turbo
@dctremblay
dctremblay / userstyle.css
Created May 18, 2024 23:57
Joplin WYSIWYG editor headers enhancements
h1 {
font-size: 3em!important;
}
h2 {
font-size: 2em!important;
}
h3 {
font-size: 1.2em!important;
@dctremblay
dctremblay / userchrome.css
Created May 18, 2024 23:50
Joplin Markdown editor headers enhancements
.cm-header-1, .cm-header-2 {
border-bottom: 1px dotted!important;
}
.cm-header-1 {
font-size: 3em!important;
display: block;
}
.cm-header-2 {
@dctremblay
dctremblay / plasma-toggle-colorscheme.sh
Last active May 21, 2024 15:40
Toggle between light/dark color scheme in KDE plasma
#!/bin/bash
light=BreezeLight
dark=BreezeDark
cur=$(plasma-apply-colorscheme --list-schemes | grep '(current color scheme)' | cut -d' ' -f3)
plasma-apply-colorscheme $([ $cur = $light ] && echo $dark || echo $light)
@dctremblay
dctremblay / rc
Last active April 19, 2024 06:05
docker-compose rc script
#!/bin/bash
HOST=srv001.example.com
USER=compose
PATH=~/some-project
migrate() { :; }
psql() { dc exec postgres psql --user postgres; }
#################