Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:

Léa Gris leagris

:octocat:
  • France - Marvejols
View GitHub Profile
View termlink.sh
View stupid_bash_fruit_game.sh
#!/usr/bin/env bash
print_basket() {
# Print remaining keys (content of basket)
for fruit in "${!basket[@]}"; do
printf '%d %s\n' "${basket[$fruit]}" "${fruit,,}"
done
}
declare -a all_fruits=(
@leagris
leagris / mandelbrot.sh
Last active January 6, 2023 17:27
Mandelbrot for POSIX shell
View mandelbrot.sh
#!/usr/bin/env sh
#
# Modified version of bash mandelbrot from Mecki stackoverflow.com/users/15809
# found at https://stackoverflow.com/a/63749612/1765658
# Avoiding forks and running bc as background task, reducing
# execution time, from many hours to less than 10' (on my desktop)
#
# Modified version for POSIX shell by Léa Gris:
# https://gist.github.com/leagris/59e1b7e72462024b278652696f375e71
# Improved to addressing fifos by FDs.
@leagris
leagris / OVHGhostNSCheck.sh
Created March 16, 2021 18:16
OVH Ghost mutualised DNS checker
View OVHGhostNSCheck.sh
#!/usr/bin/env sh
# Domain name to retrieve ghost host RR from
__ARG_DOMAIN=${1:-example.com}
# Setup the name or IP of the ghost OVH mutu hosting DNS
__ARG_GHOST_NS=${2:-dns200.anycast.me.}
old_ip=$(
dig +short +norecurs "$__ARG_DOMAIN" "@$__ARG_GHOST_NS" -t A 2>/dev/null
@leagris
leagris / renderNegativeY.java
Created January 4, 2021 03:57
Fixed renderNegativeY
View renderNegativeY.java
@Override
public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) {
Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.5F), (int) (mRGBa[1] * 0.5F), (int) (mRGBa[2] * 0.5F), mAllowAlpha ? 255 - mRGBa[3] : 255);
IIcon aIcon = mIconContainer[0].getIcon();
float minU = aIcon.getInterpolatedU((1.0D - aRenderer.renderMaxX) * 16.0D);
float maxU = aIcon.getInterpolatedU((1.0D - aRenderer.renderMinX) * 16.0D);
float minV = aIcon.getInterpolatedV(aRenderer.renderMinZ * 16.0D);
float maxV = aIcon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D);
@leagris
leagris / RendererSettings.md
Last active January 3, 2021 14:22
Renderer settings per side for correct UV regardless of block bounds
View RendererSettings.md

Renderer settings per side for correct UV regardless of block bounds:

Side field_152631_f flipTexture
XPos
XNeg
YPos
YNeg
Zpos
ZNeg
@leagris
leagris / mapfile_assoc_shim.sh
Last active December 18, 2020 02:40
A shim for Bash's mapfile to support mapping key value pairs into an associative array
View mapfile_assoc_shim.sh
#!/usr/bin/env bash
# mapfile_assoc_shim.sh
# If mapfile does not have a -A associative array mode
# then implement it
# Usage:
# include mapfile_assoc_shim.sh
# or
# . mapfile_assoc_shim.bash
#
# Example:
@leagris
leagris / github.sieve
Last active February 12, 2022 02:41
Sieve filter for GitHub notifications
View github.sieve
# rule:[notifications@github.com]
#require ["fileinto", "mailbox", "variables", "imap4flags", "regex"];
if address :is "from" "notifications@github.com" {
set "gitfolder" "Lists.GitHub";
if header :matches "List-ID" "*<*.*.github.com>" {
set "gituser" "${3}";
set "gitrepository" "${2}";
# Replace . or + by dashes for proper IMAP folder name
# Sieve has no regex global replace, so do it at max 3 occurences
if string :regex "${gitrepository}" "(.*)[.+]+(.*)" {
View crash-2020-03-08_22.21.26-client.txt
---- Minecraft Crash Report ----
// Don't do that.
Time: 3/8/20 10:21 PM
Description: Unexpected error
java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909)
at java.util.ArrayList$Itr.next(ArrayList.java:859)
at com.github.bartimaeusnek.ASM.BWCoreStaticReplacementMethodes.findCachedMatchingRecipe(BWCoreStaticReplacementMethodes.java:100)
View crash-2020-01-07_19.21.27-client.txt
---- Minecraft Crash Report ----
// This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~]
Time: 1/7/20 7:21 PM
Description: Rendering screen
java.lang.NoSuchFieldError: showStateButtons
at tconstruct.tools.gui.PartCrafterGui.modifyVisiblity(PartCrafterGui.java:249)
at codechicken.nei.LayoutManager.layout(LayoutManager.java:301)
at codechicken.nei.LayoutManager.renderObjects(LayoutManager.java:237)