Skip to content

Instantly share code, notes, and snippets.

View mlongval's full-sized avatar

Michael Longval mlongval

  • Université de Sherbrooke
  • Sherbrooke, Quebec, CANADA
  • 10:49 (UTC -05:00)
View GitHub Profile
@mlongval
mlongval / gist:c5bba043980b377f2dfcaf6e4958633d
Last active July 10, 2024 04:04
Make Zsh never go below the last 3 lines on screen. Useful if KDE Panel covers bottom of terminal when working.
# Little function to prevent Zsh from going below the bottom 3rd line of your terminal.
# Michael Longval
# mlongval <at> gmail.com
# Tags: KDE Konsole Zsh z-shell
# I was having trouble with KDE Panels covering my Konsole sometimes
# (would have to stop typing and click the panel to make it automatically disappear.)
# It works by printing 2 new-line characters and then going 2 lines back up
@mlongval
mlongval / gist:b86774fd12f5812a0b7e6f1cf14c43f9
Last active June 28, 2024 01:10
Fix Thunderbird Gmail login error (Thunderbird version 115.12.2 (64-bit))
@mlongval
mlongval / bs_to_exit.vim
Last active June 12, 2024 18:26
Map Backspace to Exit VIM if on top left corner (beginning of buffer)
" Exit Vim if Backspace key at beginning of unmodified buffer (top left)
" Very usefull if you use a terminal file explorer like Ranger
" https://github.com/ranger/ranger
" you can just got into and out of files with Enter and Backspace keys.
" Obviously will notify if buffer is modified and unsaved.
@mlongval
mlongval / Fix_BBCBasic_OwletEditor.txt
Created April 29, 2023 18:00
Fix compile problems for BBC Basic Owlet Editor
29.04.2023 13h25
I wanted to try and install mattgodbolt's cool BBC Basic
Owlet Editor on my system.
[https://github.com/mattgodbolt/owlet-editor]
Here is the blurb from the repository describing it:
Owlet Editor
@mlongval
mlongval / menu1.py
Last active August 27, 2020 17:28
Simple Menu system for CLI written in Python
#!/usr/bin/env python3
# vim: filetype=python
# Simple #!/usr/bin/env python3
# vim: filetype=python
# Michael Longval
# [email protected]
# Simple menuing system to execute scripts in $HOME/bin/menu1_items
@mlongval
mlongval / gist:78206e9c48c2eb123e1af09e807c3ac1
Created February 26, 2019 21:21
Ultisnips (Vim) snippet to set a vim modeline and set buffer language
# set the document modeline and spelling to english
snippet setenglish "" b
# vim: spell spelllang=en
`!p vim.command("set spelllang=en")`
endsnippet
# set the document modeline and spelling to french
snippet setfrench "" b
# vim: spell spelllang=fr
`!p vim.command("set spelllang=fr")`
@mlongval
mlongval / gist:9fbe1e16b97be6e16ce0675b7291da94
Created January 8, 2017 06:01
Practice Python 05 march 2014
def overlap():
import random
listA = random.sample(range(100), k=10)
listB = random.sample(range(100), k=12)
listC = list(set([x for x in listA if x in listB]))
listC.sort()
return listC
@mlongval
mlongval / ToggleGrayScaleMode
Last active February 3, 2016 14:46
MacOSX Grayscale Mode Toggle Applescript
(*
ToggleGrayScaleMode for MacOSX 10.9 Mavericks
works as of 15 april 2014
This is an AppleScript UI script to toggle GrayScaleMode in System Preferences.
I am red-green colorblind and grayscale helps a lot...
Works for me. Hope it can be usefull for you.
Mike
@mlongval
mlongval / Python3 and Matplotlib
Created February 14, 2013 04:01
Getting matplotlib to work with Python3 on Xubuntu 12.04
Getting matplotlib running with python3
Here are the steps that I went through to get Matplotlib to work.
(as far as I know so far.....)
I am using a Xubuntu 12.04 (Ubuntu) system.
(Your mileage may vary....)
@mlongval
mlongval / date.py
Last active December 13, 2015 17:39
AutoKey code snippet to insert the current date. The original version did not work, I think because I am using Python3
"""
This is for use in the AutoKey text expander under Linux
The version of this script that came with the program does not work
on my system...
I think it's because I use python3
Returns the current date. in the dd/mm/yyyy format