Skip to content

Instantly share code, notes, and snippets.

@Idorobots
Idorobots / gist:3864993
Created October 10, 2012 11:35
CPU stats example
(require 'cpu-stats)
(setq cpu-usage-update-interval 1)
(setq cpu-usage-format "Average: %A CPU0: %C0 CPU1: %C1")
(cpu-usage-start)
@Idorobots
Idorobots / gist:3865002
Created October 10, 2012 11:37
Memory Stats example
(require 'memory-stats)
(setq memory-usage-update-interval 5)
(setq memory-usage-format "Mem: %R Free: %F Swap: %S")
(memory-usage-start)
@Idorobots
Idorobots / gist:3865021
Created October 10, 2012 11:39
Network Stats example
(require 'network-speed)
(setq network-speed-update-interval 5)
(setq network-speed-precision 1)
(setq network-speed-interface-list '("wlan0" "eth0"))
(setq network-speed-format-string "Down: %RB Up: %TB")
(network-speed-start)
@Idorobots
Idorobots / gist:3865039
Created October 10, 2012 11:41
Misc Stats example
(require 'misc-stats)
(setq misc-stats-update-interval 10)
(setq misc-stats-format "Emacs uptime: %E Load average: %L1")
(misc-stats-start)
@Idorobots
Idorobots / gist:3866870
Created October 10, 2012 16:53
Mode-line code
;; MODES
(require 'battery)
(setq battery-mode-line-format "#%b %p %t")
(setq battery-load-critical 7)
(setq battery-load-low 25)
(display-battery-mode t)
(require 'network-speed)
(setq network-speed-update-interval 5)
@Idorobots
Idorobots / gist:3866974
Created October 10, 2012 17:09
Mode-line format
(setq mode-line-format
(list '(:eval (message "Using `message' here is a bad idea..."))
'(:propertize " No really. Stop it!"
face font-lock-warning-face)
))
@Idorobots
Idorobots / gist:3867028
Created October 10, 2012 17:17
VC colors
(defvar my-vc-alist '(;; Everything is ok:
(up-to-date some-green-face)
;; Kinda important:
(edited some-yellow-face)
(added some-yellow-face)
;; Most important:
;; ...
))
(setq mode-line-format
@Idorobots
Idorobots / gist:3867068
Created October 10, 2012 17:24
Tool tips
(setq mode-line-format
(list ;; ...
'(:propertize "%@" help-echo (concat "Default directory is: "
default-directory)
mouse-face mode-line-highlight)
;; ...
))
@Idorobots
Idorobots / gist:3867095
Created October 10, 2012 17:30
Mode-line images
(defvar some-image (create-image "foo.xpm" 'xpm nil
:ascent 'center))
(setq mode-line-format
(list ;; ...
'(:eval (propertize "unimportant" 'display some-image))
;; ...
))
@Idorobots
Idorobots / gist:3889721
Created October 14, 2012 20:27
sample makefile
RM = rm
CC = gcc
CFLAGS = -Wall -pedantic -O4 -ffast-math
LDLIBS = -lm
TARGET = foo
OBJS = foo.o main.o
all: $(TARGET)