Skip to content

Instantly share code, notes, and snippets.

View thriveth's full-sized avatar

T. Emil Rivera-Thorsen thriveth

View GitHub Profile
@thriveth
thriveth / batt_stat_string.py
Last active June 13, 2017 22:09
Small Python script that returns a string encoding (linux) laptop battery status. Each char represents 10%. a `-` means empty, `🞂` means charging, and `🞀` means running on battery power. Strongly inspired by Steve Losh's zsh prompt http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/#my-right-prompt-battery-capacity, but changed quite a …
#!/usr/bin/env python
# coding=UTF-8
import math, subprocess, sys
batt_info = subprocess.check_output('acpi').split(b',')
batt_info = [l.strip() for l in batt_info]
percnt = int(batt_info[1][:-1])
total_slots, slots = 10, []
if batt_info[0].split()[-1] == 'Charging':
@thriveth
thriveth / battery_prompt.py
Created August 24, 2018 11:00
Python script to return a zsh-formatted string to show battery status in your prompt.
#!/usr/bin/env python3
# -*- coding=utf-8 -*-
""" This script requires acpi to be installed """
import math
import subprocess
import sys
# Output
batt_info = subprocess.check_output("acpi").split(b',')
batt_info = [l.strip() for l in batt_info]
@thriveth
thriveth / init.el
Created October 28, 2022 01:41
minimal-ish Emacs config to work with Bibliographies and references
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(require 'use-package)
(setq custom-file (expand-file-name "emacs-custom.el" user-emacs-directory))
(load custom-file)
@thriveth
thriveth / Evil-General.org
Created November 5, 2022 17:23
Evil-mode setup and keybindings managed with General.el

Evil-mode & friends

EVIL itself

(use-package evil
  :init
  (setq evil-want-keybinding nil)	;
  (setq evil-want-integration t)
  :config
  (define-key evil-normal-state-map (kbd "C-h") 'evil-window-left)