Skip to content

Instantly share code, notes, and snippets.

Ivan Toshkov itoshkov

View GitHub Profile
@itoshkov
itoshkov / toggle-earmuffs.el
Created Nov 22, 2011
Emacs lisp toggle-earmuffs
View toggle-earmuffs.el
(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))
View MoulderTest.java
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;
View recipe.json
{
"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 / nutritions.json
Last active Dec 28, 2015
Abridged nutritional info. JSON format doesn't support comments, so I used "..." instead.
View nutritions.json
{
"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",
View post-request.sh
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 / move-images.sh
Last active Oct 5, 2016
Move images with certain size to directory
View move-images.sh
identify -format "%wx%h,%f\n" * | grep '^1920x1080,' | colrm 1 10 | while read f; do mv "$f" /tmp/t; done
View install-papirus-home.sh
#!/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 / init.el
Created Dec 19, 2018
Change the emacs theme to light or dark variant (GTK+-3)
View init.el
(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)
You can’t perform that action at this time.