Skip to content

Instantly share code, notes, and snippets.

View legumbre's full-sized avatar

Leonardo Etcheverry legumbre

  • GlamST / Ulta
  • Montevideo, Uruguay
View GitHub Profile
@legumbre
legumbre / gist:1182280
Created August 30, 2011 22:29
unpaper | postprocessing scanned book example
# convert multipage pdf to single page tiff
gs -q -dNOPAUSE -dBATCH -sDEVICE=tiffg4 -sOutputFile=%04d.tif source.pdf -c qui
# or use -sDEVICE=pgmraw to convert to pgm
# unpaper, rotate the logical page 90 degrees, each logical page contained two scanned physical pages, so we use --layout double (for input) and --output-pages 2 since we want to split these two pages.
unpaper -v --deskew-scan-deviation 3.0 --border-align top --deskew-scan-range 15 --no-grayfilter --no-blurfilter --no-noisefilter --overwrite --pre-rotate 90 --border-scan-step 4 --layout double --output-pages 2 %04d.pgm.pbm unpaper%04d.pbm
# trim the pages and convert the to single-page pdfs
find . -name 'unpaper*' | xargs -i -n1 -P6 convert -trim +repage {} {}.pdf

Ring Run dev workflow de LLL

Motivación

  • Evitar XCode en cuanto sea posible. Solo se usa xcodebuild si se tocaron fuentes C/Obj-C.
  • Comandos y funciones de conveniencia para iniciar y controlar RR desde Emacs.
  • Forma fácil de evaluar chunks y expresiones en el contexto del RR desde Emacs.
  • Chequeo básico de sintaxis antes de largar el juego y mientras se edita un archivo.
@legumbre
legumbre / input_glsl.frag
Created April 5, 2021 15:26
SPIRVCross | GLSL specialization constants -> MSL
#version 310 es
precision mediump float;
layout (constant_id = 0) const bool kSomeFlag = true;
layout(location = 0) out vec4 FragColor;
void main()
{
if (kSomeFlag)
@legumbre
legumbre / integrated_GPUs_Metal.md
Last active October 21, 2020 16:07
Using the Integrated GPU with Metal

Using Integrated GPU with Metal

The following steps were required to get a Metal-based renderer on macos Mojave (10.4.6) to use the Intel (Integrated) GPU instead of the AMD discrete one (High Perf GPU).

  1. Do not use MTLCreateDefaultDevice. Instead, use MTLCopyAllDevices to get a list of all available GPUs and then keep the one satisfying device.lowPower == true

  2. Set "Supports Automatic Graphics Switching" (NSSupportsAutomaticGraphicsSwitching)key in the App's Info.plist to YES

Launch Activity Monitor and verify the App is now listed with "Requires High-Perf GPU: NO".

;;; lua-mode.el --- a major-mode for editing Lua scripts
;; Copyright (C) 1997, 2001, 2004, 2006, 2007, 2010, 2011 Free Software Foundation, Inc.
;; Author: 2011 immerrr <immerrr+lua@gmail.com>
;; 2010-2011 Reuben Thomas <rrt@sc3d.org>
;; 2006 Juergen Hoetzel <juergen@hoetzel.info>
;; 2004 various (support for Lua 5 and byte compilation)
;; 2001 Christian Vogler <cvogler@gradient.cis.upenn.edu>
;; 1997 Bret Mogilefsky <mogul-lua@gelatinous.com> starting from
@legumbre
legumbre / foo.md
Created June 29, 2012 00:14
resolving merge conflicts with magit-ediff

Use magit-ediff to resolve merge conflicts

Use magit-ediff or 'e' on an unmerged item to resolve merge conflicts with ediff. Magit will set up an ediff with three buffers A, B and C. A and B are the original (conflicting) files, and C is the conflicted merge.

Use 'n'/'p' to move to the next/previous conflict, use 'a'/'b' to choose which changes (those in a A or B) should be the ones to keep in the merged file.

You can always just switch to buffer C and edit what the merged version should look like.

@legumbre
legumbre / love2d.el
Created November 18, 2014 21:01
launch love2d app from Emacs
(defvar love2d-program "~/dev/love.app/Contents/MacOS/love")
(defun love2d-launch-current ()
(interactive)
(let ((app-root (locate-dominating-file (buffer-file-name) "main.lua")))
(if app-root
(shell-command (format "%s %s &" love2d-program app-root))
(error "main.lua not found"))))
> for i=1,63 do print(bit.lshift(0x1ULL,i)) end
2ULL
4ULL
8ULL
16ULL
32ULL
64ULL
128ULL
256ULL
512ULL
/ > pwd
/
/ > ls
--- 35 waves
/ > whereis //spawns
/waves/wave[1]/spawns
/waves/wave[2]/spawns
/waves/wave[3]/spawns
/waves/wave[4]/spawns
/ > whereis /spawn
pyftsubset -- OpenType font subsetter and optimizer
pyftsubset is an OpenType font subsetter and optimizer, based on fontTools.
It accepts any TT- or CFF-flavored OpenType (.otf or .ttf) or WOFF (.woff)
font file. The subsetted glyph set is based on the specified glyphs
or characters, and specified OpenType layout features.
The tool also performs some size-reducing optimizations, aimed for using
subset fonts as webfonts. Individual optimizations can be enabled or
disabled, and are enabled by default when they are safe.