Skip to content

Instantly share code, notes, and snippets.

@Hi-Angel
Hi-Angel / foo.el
Last active Aug 29, 2021
Functions needed for Emacs to check multiple languages simultaneously. Tested under `emacs -Q` as of 28.0.50 version. Make sure to have the hunspell dictionaries!
View foo.el
(progn
(require 'ispell)
(setq ispell-program-name "hunspell")
(ispell-set-spellchecker-params)
(ispell-hunspell-add-multi-dic "ru_RU,en_US")
(ispell-change-dictionary "ru_RU,en_US" t)
(flyspell-mode 1)
)
@Hi-Angel
Hi-Angel / package-deb-libinput.sh
Last active Jan 20, 2021
A script to package built libinput as a deb.
View package-deb-libinput.sh
#!/bin/bash
# NOTE: make sure the libinput build is configured with --prefix=/usr/. It is
# important, so libraries upon installation end up in correct locations.
set -e
if [ "$#" -ne 1 ]; then
echo "Wrong number of parameters.
Usage: $(basename $0) build_dir"
exit 1
fi
View show_clipboard_formats.py
#!/usr/bin/python
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
formats = '\n'.join([str(x) for x in clipboard.wait_for_targets()[1]])
print("Current clipboard offers formats: " + formats)
@Hi-Angel
Hi-Angel / github-pandoc.css
Created Apr 30, 2020 — forked from dashed/github-pandoc.css
GitHub-like CSS for pandoc standalone HTML files (perfect for HTML5 output). Based on Marked.app's GitHub CSS. Added normalize.css (v2.1.3) in the prior to GitHub css.
View github-pandoc.css
/*! normalize.css v2.1.3 | MIT License | git.io/normalize */
/* ==========================================================================
HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined in IE 8/9.
*/
@Hi-Angel
Hi-Angel / disable-touchpad-pm.service
Created Apr 28, 2020
/etc/systemd/system/disable-touchpad-pm.service
View disable-touchpad-pm.service
# disables Acer aspire v3 572g touchpad PM to work around input delays
[Service]
Type=oneshot
ExecStart=sh -c "echo on > /sys/bus/i2c/devices/i2c-0/device/power/control"
RemainAfterExit=true
[Install]
WantedBy=multi-user.target
View clock_gettime_override.cpp
#include <dlfcn.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
extern "C"
int clock_gettime(clockid_t clk_id, struct timespec *tp) {
using clock_gettime_ptr = int (*)(clockid_t, struct timespec*);
const static clock_gettime_ptr real_clock_gettime
= (clock_gettime_ptr) dlsym(RTLD_NEXT, "clock_gettime");
@Hi-Angel
Hi-Angel / noop.hpp
Last active Jan 3, 2019
noop protocol client-header generated
View noop.hpp
/* Generated by wayland-scanner 1.16.0 */
#ifndef PROTOCOL_NOOP_CLIENT_PROTOCOL_H
#define PROTOCOL_NOOP_CLIENT_PROTOCOL_H
#include <stdint.h>
#include <stddef.h>
#include "wayland-client.h"
#ifdef __cplusplus
@Hi-Angel
Hi-Angel / format.py
Created Oct 1, 2017
a python UNO code I used to format my student papers.
View format.py
#!/usr/bin/python3
import uno
import os
# that's like a consts, but they isn't since consts not allowed in python 😝
HEADING1 = "Heading 1"
HEADING2 = "Heading 2"
HEADING5 = "Heading 5" #appendinx
STYLESFILE = "./styles.odt"
PAGE_BEFORE = 4 #that is from enumeration — that awful API have problems with them
@Hi-Angel
Hi-Angel / 50-udiskie.rules
Last active May 18, 2020
Make polkit allow mounting by user in "storage" group
View 50-udiskie.rules
// Tested with ArchLinux. Cures dolphin/nautilus error "Not authorized to perform action" upon mounting.
// Sources: http://smcv.pseudorandom.co.uk/2015/why_polkit/ and https://github.com/coldfix/udiskie/wiki/Permissions
// 1. make sure you are in "storage" group
// 2. create /etc/polkit-1/rules.d/50-udiskie.rules file with the following content
polkit.addRule(function(action, subject) {
var YES = polkit.Result.YES;
// NOTE: there must be a comma at the end of each line except for the last:
var permission = {
// required for udisks1:
// "org.freedesktop.udisks.filesystem-mount": YES,