Skip to content

Instantly share code, notes, and snippets.

View gbourant's full-sized avatar

gbourant gbourant

View GitHub Profile
@julianandrews
julianandrews / send-gmail.sh
Created April 22, 2021 16:46
Simple shell script to send email using gmail
# Depends on: msmtp, libsecret-tools
#
# Set password:
# secret-tool store --label="msmtp password for jandrews271@gmail.com" service msmtp username jandrews271@gmail.com
#
# Send mail:
# echo "Message Body" | send-gmail myusername recipient@exmaple.com "My Subject"
send-gmail() {
local user="$1"
local to="$2"
@x1unix
x1unix / lenovo-legion-5-backlight-fix.md
Last active March 31, 2024 16:53
Lenovo Legion 5 Backlight Fix

Brief explanation

Linux exposes a special interface to control screen brightness via sysfs in /sys/class/backlight (source). The problem is that in Lenovo Legion 5 there are two modules registered to control screen brightness - AMDGPU and ideapad modules:

$ ls /sys/class/backlight
amdgpu_bl0
ideapad
@mitchellh
mitchellh / merge_vs_rebase_vs_squash.md
Last active April 22, 2024 16:22
Merge vs. Rebase vs. Squash

I get asked pretty regularly what my opinion is on merge commits vs rebasing vs squashing. I've typed up this response so many times that I've decided to just put it in a gist so I can reference it whenever it comes up again.

I use merge, squash, rebase all situationally. I believe they all have their merits but their usage depends on the context. I think anyone who says any particular strategy is the right answer 100% of the time is wrong, but I think there is considerable acceptable leeway in when you use each. What follows is my personal and professional opinion:

@pauloevpr
pauloevpr / hx-clone.js
Created January 7, 2024 19:47
Simple HTMX extension to allow cloning <template> elements in the DOM to avoid a round trip to the server.
htmx.config.useTemplateFragments = true
htmx.defineExtension('clone', {
onEvent: function (name, evt) {
if (name === 'htmx:beforeRequest') {
if (evt.detail.elt) {
const get = evt.detail.elt.getAttribute('hx-get')
if (get && get.startsWith('clone:')) {
const selector = get.substring(6)
//console.log('htmx-clone: Intercepting xhr request to inject template with selector:', selector)
const template = document.querySelector(selector)

Setup tor proxy on Arch Linux

Copied from this article.

Installation

  1. Install tor

         $ sudo pacman -S tor
         $ ## nyx provides a terminal status monitor for bandwidth usage, connection details and more.

$ sudo pacman -S nyx

@CMCDragonkai
CMCDragonkai / regular_expression_engine_comparison.md
Last active May 4, 2024 16:50
Regular Expression Engine Comparison Chart

Regular Expression Engine Comparison Chart

Many different applications claim to support regular expressions. But what does that even mean?

Well there are lots of different regular expression engines, and they all have different feature sets and different time-space efficiencies.

The information here is just copied from: http://regular-expressions.mobi/refflavors.html

@barbietunnie
barbietunnie / udemy-courses-download-using-cookies.md
Last active May 5, 2024 04:06
Downloading Udemy videos with youtube-dl

How to download your Udemy course videos using youtube-dl

$ youtube-dl --list-extractors | grep udemy

Steps

  1. Get link to the course to download. e.g. https://www.udemy.com/course-name/
  2. Login into udemy website, save the cookie from chrome using Chrome (Cookie.txt)[1] export extension. Save it to file udemy-cookies.txt
  3. Get the link of the video that you want to download. usually in format. Use the command provided below where you have to replace the {course_link} and {path_to_cookies_file} with respective paths.
$ youtube-dl {course_link} --cookies {path_to_cookies_file}
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active May 6, 2024 10:42
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@robertpainsi
robertpainsi / commit-message-guidelines.md
Last active May 7, 2024 00:47
Commit message guidelines

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages