Skip to content

Instantly share code, notes, and snippets.

@gregberns
gregberns / the-algebra-of-algebraic-data-types.md
Created December 13, 2018 05:57
The Algebra of Algebraic Data Types, Part 1, by Chris Taylor
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active July 17, 2024 18:10
set -e, -u, -o, -x pipefail explanation
@rometsch
rometsch / i3autolock.md
Last active July 5, 2024 19:43
Configure lockscreen for i3 window manager.

The i3-wm does not come with a keybinding to lock the screen or a preconfigured auto lockscreen. This gist describes how to setup both using i3lock and xautolock. i3lock is a minimalistic lockscreen and xautolock monitors mouse and keyboard activities to automatically lock the screen after a certain time of beiing inactive.

First get the tools if neccessary. E.g. sudo apt install i3lock xautolock.

To setup the keybinding Ctrl+Alt+l (last one is a lowercase L) to lock the screen append the following lines to the i3 configuration file located at ~/.config/i3/config.

# keybinding to lock screen

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

// Bonfire: Check for Palindromes
// Author: @iamanubhavsaini
// Challenge: http://www.freecodecamp.com/challenges/bonfire-check-for-palindromes?solution=function%20palindrome(str)%20%7B%0A%20%20var%20nstr%20%3D%20str.match(%2F%5B%5E%5CW_%5D%2B%2Fgi).map(String.toLowerCase).join(%27%27)%3B%0A%20%20console.log(nstr)%3B%0A%20%20return%20nstr%20%3D%3D%3D%20nstr.split(%27%27).reverse().join(%27%27)%3B%0A%7D%0A%0A%0A%0Apalindrome(%220_0%20(%3A%20%2F-%5C%20%3A)%200-0%22)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function palindrome(str) {
var nstr = str.match(/[^\W_]+/gi).map(String.toLowerCase).join('');
console.log(nstr);
return nstr === nstr.split('').reverse().join('');
}
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],