Skip to content

Instantly share code, notes, and snippets.

@lleaff
lleaff / Unreal Engine AZERTY Keyboard shortcuts
Created March 4, 2015 23:35
Editor preferences > Keyboard shortcuts > Import...
[UserDefinedGestures]
UserDefinedGestures=~OpenBracket~~Quote~BindingContext~Quote~:~Quote~EditorViewportClient~Quote~,~Quote~CommandName~Quote~:~Quote~Forward~Quote~,~Quote~Control~Quote~:false,~Quote~Alt~Quote~:false,~Quote~Shift~Quote~:false,~Quote~Command~Quote~:false,~Quote~Key~Quote~:~Quote~Z~Quote~~CloseBracket~
UserDefinedGestures=~OpenBracket~~Quote~BindingContext~Quote~:~Quote~EditorViewportClient~Quote~,~Quote~CommandName~Quote~:~Quote~FovZoomOut~Quote~,~Quote~Control~Quote~:false,~Quote~Alt~Quote~:false,~Quote~Shift~Quote~:false,~Quote~Command~Quote~:false,~Quote~Key~Quote~:~Quote~W~Quote~~CloseBracket~
UserDefinedGestures=~OpenBracket~~Quote~BindingContext~Quote~:~Quote~EditorViewportClient~Quote~,~Quote~CommandName~Quote~:~Quote~Left~Quote~,~Quote~Control~Quote~:false,~Quote~Alt~Quote~:false,~Quote~Shift~Quote~:false,~Quote~Command~Quote~:false,~Quote~Key~Quote~:~Quote~Q~Quote~~CloseBracket~
UserDefinedGestures=~OpenBracket~~Quote~BindingContext~Quote~:~Quote~EditorViewportClient~Quote~,~Quote~C
#!/bin/bash
#
# skippy-wrapper - B. Murphy
#
# a work around for the bug in skippy-xd that prevents minimized
# windows being included in the selection screen.
#
# dependency: xdotool
#
@lleaff
lleaff / skippy-xd.rc
Created November 2, 2015 14:13
~/.config/skippy-xd/skippy-xd.rc
# Copy this to ~/.config/skippy-xd/skippy-xd.rc and edit it to your liking
#
# Notes:
#
# - colors can be anything XAllocNamedColor can handle
# (like "black" or "#000000")
#
# - distance is a relative number, and is scaled according to the scale
# factor applied to windows
#
@lleaff
lleaff / imagepanel.php
Last active July 30, 2016 01:16
Create a grid of images from those in a given webpage
#!/usr/bin/env php
<?php
/* =Config
*------------------------------------------------------------*/
$FONT_PATH = "OpenSans-Regular.ttf";
/* pixels */
$CELL_WIDTH_IDEAL = 100;
@lleaff
lleaff / Youtube_-_Copy_short_URL_to_clipboard.user.js
Last active February 17, 2022 16:10
Youtube Userscript: Copy short URL to clipboard on video title click
// ==UserScript==
// @name Youtube - Copy short URL to clipboard
// @namespace lleaff
// @supportURL https://gist.github.com/lleaff/48db35c180ab1b684a0f2c7d9c493244#comments
// @match https://www.youtube.com/*
// @version 2
// @run-at document-end
// @grant GM_setClipboard
// @noframes
// @description Copy short URL to clipboard on video title click
@lleaff
lleaff / arraySliceEveryN.js
Last active October 11, 2016 08:21
arraySliceEveryN(array, n)
/**
* Slice an array every n elements. Don't leave out any elements from source array or
* empty spaces in the resulting slices.
* @example
* arraySliceEveryN([1,2,3,4,5,6,7], 3)
* //=> [[1,4,7],[2,5],[3,6]]
*/
function arraySliceEveryN(array, n) {
let slices = Array(n);
const min_len = Math.floor(array.length / n); // Length without remaining elements
@lleaff
lleaff / escapeHTMLTags.js
Last active September 8, 2016 10:35
Selectively escape or exclude from escaping HTML tags
/**
* Slice an array every n element
* @example
* array_slice_every_n([1,2,3,4,5,6,7], 3)
* //=> [[1,4,7],[2,5],[3,6]]
*/
function array_slice_every_n(array, n) {
let subs = Array(n);
const min_len = Math.floor(array.length / n);
const rem = array.length - n * min_len;
@lleaff
lleaff / Discord_-_Open_chat_in_popup.user.js
Last active September 9, 2021 22:08
Adds a "open in popup" button to channels
// ==UserScript==
// @name Discord - Open chat in popup
// @namespace lleaff
// @updateURL https://gist.github.com/lleaff/8514033dc8e54ce02d6adf3c2e46d8ff/raw/Discord_-_Open_chat_in_popup.user.js
// @supportURL https://gist.github.com/lleaff/8514033dc8e54ce02d6adf3c2e46d8ff#comments
// @match https://discordapp.com/channels/*
// @version 1
// @run-at document-end
// @grant none
// @noframes
@lleaff
lleaff / mergeConsecutiveElements.js
Created December 15, 2016 14:01
Merge consecutive array elements
const last = a => a[a.length - 1];
const mergeConsecutive = (arr, el) => (arr.length <= 1) ?
arr :
arr.slice(1).reduce((p, v) => v === el && last(p) === v ?
p :
[...p, v], [arr[0]]);
const mergeConsecutiveElements = arr => (arr.length <= 1) ?
arr :
arr.slice(1).reduce((p, v) => last(p) === v ? p : [...p, v], [arr[0]]);
@lleaff
lleaff / readnum.c
Created February 9, 2017 13:21
C89: Read number from stdin and reformat
/*
* Compile:
* gcc -Wall -Werror -pedantic -ansi -std=c89 readnum.c
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>