Skip to content

Instantly share code, notes, and snippets.

View kvpb's full-sized avatar
📸
Say 'cheese', or else!

Karl kvpb

📸
Say 'cheese', or else!
View GitHub Profile
@kvpb
kvpb / LICENSE
Last active March 2, 2025 09:44
Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025 by Karl Vincent Pierre Bertin AKA Karl Thomas George West
Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Karl Vincent Pierre Bertin not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Karl Vincent Pierre Bertin makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
@kvpb
kvpb / 42header.txt
Last active July 27, 2022 10:39
My 42 header retrieved from an old file from one of the daily projects of the piscine of late 2014.
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* filename :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kbertin <kbertin@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: YYYY/MM/DD hh:MM:SS by kbertin #+# #+# */
/* Updated: YYYY/MM/DD hh:MM:SS by kbertin ### ########.fr */
/* */
@kvpb
kvpb / script69.sh
Last active July 28, 2022 11:12
Test Script 69: set macOS keyboard speed
#!/usr/bin/env bash
osascript -e 'tell application "System Preferences" to quit' #
defaults delete com.apple.universalaccess slowKey
defaults write com.apple.universalaccess slowKey -bool FALSE # Disable Slow Keys. (i) Required from macOS 10.12 Sierra onwards to set faster key repeat rates.
defaults delete com.apple.universalaccess slowKeyDelay
#defaults write com.apple.universalaccess slowKeyDelay -int 5 #
defaults delete NSGlobalDomain ApplePressAndHoldEnabled
@kvpb
kvpb / script70.sh
Last active July 28, 2022 10:56
Test Script 70: BASH pseudo-multidimensional array iteration over any dimension
#!/usr/bin/env bash
var1=([0]="first" [1]="second" [2]="third" [5]="sixth" [10]="eleventh");
n=([0]="0" [1]="1" [2]="2" [5]="5" [10]="10");
var2=([0]="zero" [1]="one" [2]="two" [5]="five" [10]="ten");
printf '\n`echo \"${var1[@]}\"` s output:\t'; echo "${var1[@]}";
printf '`echo \"${!var1[@]}\"` s output:\t'; echo "${!var1[@]}";
printf '\nWith `${var1[@]}`:\n';
@kvpb
kvpb / script71.sh
Last active July 28, 2022 11:13
Test Script 71: BASH pseudorandom brute-forcing
#!/usr/bin/env bash
mkdir directory && cd directory
for i in {0..99}
do
> file${i}
printf "make file${i}\n"
done #for i in {0..0}{0..9}{0..9}; do > file${i}; echo file${i}; done
@kvpb
kvpb / script72.sh
Last active July 28, 2022 11:14
Test Script 72: delete directory from user home
#!/usr/bin/env bash
if [ -d "${symbolic_link_or_directory}" ]; # If symbolic_link_or_directory exists...
then
if [ -L "${symbolic_link_or_directory}" ]; # If symbolic_link_or_directory is a symbolic link...
then
rm "${symbolic_link_or_directory}"; # Remove symbolic_link_or_directory.
else # Else, i.e. if symbolic_link_or_directory is a directory...
if [ $(ls -A "${symbolic_link_or_directory}") ]; # If symbolic_link_or_directory is empty...
then
@kvpb
kvpb / script73.sh
Last active July 28, 2022 11:08
Test Script 73: BASH pairwise comparison without duplicates
#!/usr/bin/env bash
var=( {0..9} ); #var=( $({0..$[RANDOM%+9]}) );
printf "Set: {$(var2=$(printf ", %s" "${var[@]}") && var2=${var2:2} && printf "${var2}\n";)}"'\n'"Pairs: "'\n';
for (( i = 0; i < ${#var[@]}; i++ ));
do
for (( j = i + 1; j < ${#var[@]}; j++ ));
do
# printf "(${i}, ${j}): "'%d\n'; #printf "(${!var[${i}]}, ${!var[${j}]}): "'%d\n'; # array element nummbers
#if !idppc
/*
** float q_rsqrt( float number )
*/
float Q_rsqrt( float number )
{
long i;
float x2, y;
const float threehalfs = 1.5F;
@kvpb
kvpb / Box_names_code_for_custom_mass_oubreaks_-Emerlad_ACE-.txt
Last active July 27, 2022 13:28
List of codes for 0611 execution (Merrp's ACE, Pokémon Emerald)
Instructions: execute the codes in order. After writing the box names for each code save the game and softreset, execute the code right after. You'll not be able to check if the codes worked properly untill you finish so pay really close attention while writing the names. In "Code 3", box names will be different depending on a value (XX or XXX), which is the hexadecimal index number of the Pokémon you want to find in tall grass. You can find a list of Pokémon by index number here:
https://bulbapedia.bulbagarden.net/wiki/List_of_Pok%C3%A9mon_by_index_number_(Generation_III)
You'll see how to use this value directly in "Code 3"
After the execution of all the three codes, if you enter a battle in the tall grass in the Mirage Island you'll find the Pokémon you're aiming for at Lv.0 with four Sketch as moves. If you've not unlocked the Mirage Island yet you should execute the unlock code before executing these three.
If your game has a working internal battery, the effect of this code will last for 11 days (cons