Skip to content

Instantly share code, notes, and snippets.

View ihabunek's full-sized avatar

Ivan Habunek ihabunek

View GitHub Profile
"""
Attempt to display an image in Textual using the kitty graphics protocol.
This currently does not work, even though render_kitty() itself works and
printing the resulting Text will display it in console.
"""
import asyncio
from asyncio.subprocess import PIPE
@ihabunek
ihabunek / gist:3957832
Created October 26, 2012 09:27
Install Apache log4php using Composer

Install Apache log4php using Composer

First, install Composer if you don't yet have it:

php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"

Create a composer.json file with the following content:

{

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ihabunek
ihabunek / gist:c74fb2d555fecea37aef
Created July 6, 2015 07:46
Compile PHP On Windows
====== Build your own PHP on Windows ======
===== Before you Begin =====
Building PHP on Windows will require three things
- A properly set up build environment, including a compiler with the right SDK's and some binary tools used by the build system
- Prebuilt libraries and headers for third party libraries that PHP uses in the correct location
- The PHP source
===== Compiler =====
@ihabunek
ihabunek / 1-short-life.hs
Last active November 6, 2020 20:39
Conway's Game of Life in Haskell (condensed and regular version)
module ObfuscatedGame where
import Data.Set as Set
neighbours p = Set.fromList [(fst p + dx, snd p + dy) | dx <- [-1..1], dy <- [-1..1], not (dx == 0 && dy == 0)]
lives g p = ((member p g) && count `elem` [2, 3]) || (not (member p g) && count == 3)
where count = Set.size $ Set.filter (flip member g) (neighbours p)
nextGen g = Set.filter (lives g) (union g $ unions [neighbours p | p <- toList g])
meta {
title: "Highlighted capes and bays";
description: "Highlights capes and bays for better visibility.";
version: "1.0.0_2020-03-24";
author: "Ivan Habunek";
}
node|z14-[natural=cape],
node|z14-[natural=bay] {
text: auto;
CREATE OR REPLACE FUNCTION anonymize_people()
RETURNS void AS
$$
DECLARE
first_names text[] := '{"April","Abigail","Adriana","Adrienne","Aimee","Alejandra","Alexa","Alexandra","Alexandria","Alexis","Alice","Alicia","Alisha","Alison","Allison","Alyssa","Amanda","Amber","Amy","Ana","Andrea","Angel","Angela","Angelica","Angie","Anita","Ann","Anna","Anne","Annette","Ariana","Ariel","Ashlee","Ashley","Audrey","Autumn","Bailey","Barbara","Becky","Belinda","Beth","Bethany","Betty","Beverly","Bianca","Bonnie","Brandi","Brandy","Breanna","Brenda","Briana","Brianna","Bridget","Brittany","Brittney","Brooke","Caitlin","Caitlyn","Candace","Candice","Carla","Carly","Carmen","Carol","Caroline","Carolyn","Carrie","Casey","Cassandra","Cassidy","Cassie","Catherine","Cathy","Charlene","Charlotte","Chelsea","Chelsey","Cheryl","Cheyenne","Chloe","Christie","Christina","Christine","Christy","Cindy","Claire","Claudia","Colleen","Connie","Courtney","Cristina","Crystal","Cynthia","Daisy","Dana","Danielle","Darlene","Dawn","Deanna

Line selection

The URL hash (fragment) describes the selected lines. Examples:

hash description
#L10 single line
#L10,15,20 multiple lines
#L10-15 span of lines
From 53fec5930a999b22fcb633495ae61d24fa997614 Mon Sep 17 00:00:00 2001
From: Ivan Habunek <ivan@habunek.com>
Date: Tue, 15 Jan 2019 11:07:30 +0100
Subject: [PATCH git.sr.ht] This is the title, upto 50 chars
To: ~sircmpwn/sr.ht-dev@lists.sr.ht
The rest of the commit message goes here.
---