Skip to content

Instantly share code, notes, and snippets.

View vzaliva's full-sized avatar

Vadim Zaliva vzaliva

View GitHub Profile
@vzaliva
vzaliva / ThinkLight
Created May 22, 2016 14:27
This script controll keyboard backlight on IBM ThinkPad X-series
#!/bin/bash
# Vadim Zaliva lord@crocodile.org
# based on https://gist.github.com/hadess/6847281
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
@vzaliva
vzaliva / set_lang.py
Last active April 16, 2022 09:14
Script to toggle between the two last used language in Gnome
#!/usr/bin/env python3
#
# Script to toggle between the two last used language in Gnome
#
# History:
#
# Original script by Jacob Vlijm
# Saving last language and togging: Vadim Zaliva
#
# See also: http://askubuntu.com/questions/871678/how-can-i-quickly-switch-between-two-out-of-multiple-languages
@vzaliva
vzaliva / emacs-grammarly-support.txt
Created April 11, 2022 22:05
emacs grammarly support project
I am a big fan of Grammarly ( https://grammarly.com/ ). I am also an Emacs user. I do most of my academic and technical writing in LaTeX or Org-mode in Emacs, and it is crucial for me to have Grammarly working there.
Until recently, there was a way to use Grammarly from Emacs using an unofficial LSP-server (https://github.com/znck/grammarly). Unfortunately, it stopped working and is no longer supported. The main developer was hired by Grammarly and said an official SDK would replace it, but it is unclear when it will happen, and I am not betting on it as company priorities might change.
The second part of this is lsp-grammarly (https://github.com/emacs-grammarly/lsp-grammarly) emacs package. It was working but could be improved.
The final part is to make lsp-grammarly work with org-mode and LaTeX-modes. The last time I used it, it worked reasonably well, but just in case, we can keep an eye on and fix issues reported.
It is such an important tool for my everyday work that I decided to initiate a project
@vzaliva
vzaliva / Hundred.hs
Last active October 22, 2021 20:26
Print numbers from 1 to 100 without using any numbers in the code
{-# LANGUAGE NoImplicitPrelude #-}
{-
Problem statment: "Is it possible to print numbers from 1 to 100
without using any numbers in the code? If yes, how?"
Source:
https://www.quora.com/Is-it-possible-to-print-numbers-from-1-to-100-without-using-any-numbers-in-the-code-If-yes-how
For generality, this solution can print any ranges of natural numbers
@vzaliva
vzaliva / WriterComonad.v
Last active September 26, 2021 21:34
Writer Comonad in Coq
Require Import Coq.Program.Basics.
Require Import Coq.Logic.FunctionalExtensionality.
Require Import ExtLib.Structures.Monads.
Require Import ExtLib.Data.Monads.IdentityMonad.
Require Import ExtLib.Structures.Monoid.
Require Import ExtLib.Data.Monads.WriterMonad.
Require Import ExtLib.Data.PPair.
Require Import ExtLib.Structures.CoMonad.
Require Import ExtLib.Core.Type.
@vzaliva
vzaliva / remove-old-kernels.sh
Created April 1, 2017 07:44
Script to free space on /boot partition by removing old kernels
#!/bin/bash
kernelver=$(uname -r | sed -r 's/-[a-z]+//')
unused=`dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve $kernelver`
echo "Your current kernel is version is $kernelver"
if [ -z "$unused" ]; then
echo "No old kernels to remove."
exit 0
fi