Skip to content

Instantly share code, notes, and snippets.

@itoshkov
itoshkov / init.el
Created December 19, 2018 22:42
Change the emacs theme to light or dark variant (GTK+-3)
(defun set-emacs-frames (variant)
(dolist (frame (frame-list))
(let* ((window-id (frame-parameter frame 'outer-window-id))
(id (string-to-number window-id))
(cmd (format "xprop -id 0x%x -f _GTK_THEME_VARIANT 8u -set _GTK_THEME_VARIANT \"%s\""
id variant)))
(call-process-shell-command cmd))))
(defun set-emacs-theme-light ()
(interactive)
#!/bin/bash
# Download and install the latest Papirus Icon theme
#set -x
set -e
DL_URL="https://github.com/PapirusDevelopmentTeam/papirus-icon-theme-gtk/archive/master.zip"
TARGET_DIR=$HOME/.icons
HASH_FILE=$TARGET_DIR/.papirus-icons.etag
@itoshkov
itoshkov / move-images.sh
Last active October 5, 2016 09:44
Move images with certain size to directory
identify -format "%wx%h,%f\n" * | grep '^1920x1080,' | colrm 1 10 | while read f; do mv "$f" /tmp/t; done
curl -d @recipe.json -H "Content-Type: application/json" "https://api.edamam.com/api/nutrition-details?app_id=${YOUR_APP_ID}&app_key=${YOUR_APP_KEY}"
@itoshkov
itoshkov / nutritions.json
Last active December 28, 2015 09:59
Abridged nutritional info. JSON format doesn't support comments, so I used "..." instead.
{
"uri" : "http://www.edamam.com/ontologies/edamam.owl#recipe_ec290b2568b7d745a0762f6d5db4a042",
"yield" : 15.0,
"calories" : 21814,
"dietLabels" : [ "LOW_CARB" ],
"healthLabels" : [ "DAIRY_FREE", "MILK_FREE", "PEANUT_FREE", "TREE_NUT_FREE", "SOY_FREE", "FISH_FREE", "SHELLFISH_FREE" ],
"cautions" : [ ],
"totalNutrients" : {
"ENERC_KCAL" : {
"label" : "Energy",
@itoshkov
itoshkov / recipe.json
Created November 15, 2013 11:51
Sample recipe
{
"title": "Fresh Ham Roasted With Rye Bread and Dried Fruit Stuffing",
"prep": "1. Have your butcher bone and butterfly the ham and score the fat in a diamond pattern. ...",
"yield": "About 15 servings",
"ingr": [
"1 fresh ham, about 18 pounds, prepared by your butcher (See Step 1)",
"7 cloves garlic, minced",
"1 tablespoon caraway seeds, crushed",
"4 teaspoons salt",
"Freshly ground pepper to taste",
@itoshkov
itoshkov / MoulderTest.java
Created November 10, 2012 21:32
Moulder test
import static moulder.moulds.Moulds.append;
import static moulder.moulds.Moulds.attr;
import static moulder.moulds.Moulds.forEach;
import static moulder.moulds.Moulds.text;
import static moulder.values.Values.seq;
import java.util.Arrays;
import java.util.List;
import moulder.MoulderShop;
@itoshkov
itoshkov / toggle-earmuffs.el
Created November 22, 2011 09:20
Emacs lisp toggle-earmuffs
(defun toggle-earmuffs ()
"Add or remove earmuffs (asterisks at front and end) of
variables."
(interactive)
(let* ((saved-point (point))
(variable (thing-at-point 'symbol))
(bounds (bounds-of-thing-at-point 'symbol))
(len (- (cdr bounds) (car bounds)))
(start-char (elt variable 0))