Skip to content

Instantly share code, notes, and snippets.

View kaskajp's full-sized avatar
🙈
ASCII stupid question, get a stupid ANSI!

Jonas Raneryd Imaizumi kaskajp

🙈
ASCII stupid question, get a stupid ANSI!
View GitHub Profile
@kaskajp
kaskajp / localStorageTest.js
Last active January 9, 2016 01:10
Test if localStorage is available
function localStorageTest(){
var test = 'test';
try {
localStorage.setItem(test, test);
localStorage.removeItem(test);
return true;
} catch(e) {
return false;
}
}
@kaskajp
kaskajp / .wezterm.lua
Last active September 11, 2023 21:27
WezTerm config
-- Pull in the wezterm API
local wezterm = require 'wezterm'
-- This table will hold the configuration.
local config = {}
-- In newer versions of wezterm, use the config_builder which will
-- help provide clearer error messages
if wezterm.config_builder then
config = wezterm.config_builder()
@kaskajp
kaskajp / build.py
Last active November 22, 2023 22:54
Build 4z website with Python
import os
import re
# Paths for header, footer, and the views and destination directories
header_path = '../src/includes/header.html'
footer_path = '../src/includes/footer.html'
views_dir = '../src/views/'
destination_dir = '../docs/'
# Read the content of the header and footer files with UTF-8 encoding
@kaskajp
kaskajp / aoc2023-1.py
Created December 2, 2023 07:49
AoC 2023 1
def get_first_digit(str):
for char in str:
if char.isdigit():
return char
return None
def get_last_digit(str):
for char in reversed(str):
if char.isdigit():
return char
@kaskajp
kaskajp / aoc2023-1-2.py
Created December 2, 2023 07:52
AoC 2023 1-2
words = ['1', '2', '3', '4', '5', '6', '7', '8', '9',
'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
numbers = {
'1': '1',
'2': '2',
'3': '3',
'4': '4',
'5': '5',
'6': '6',
@kaskajp
kaskajp / aoc2023-2.py
Last active December 2, 2023 13:41
AoC 2023 2
max_red = 12
max_green = 13
max_blue = 14
game_id_sum = 0
with open('input.txt', 'r') as file:
for line in file:
sets = line.split(';')
game_id = sets[0].split(':')[0].split(' ')[1]
@kaskajp
kaskajp / aoc2023-2-2.py
Last active December 2, 2023 13:41
AoC 2023 2-2
game_total_power = 0
with open('input.txt', 'r') as file:
for line in file:
sets = line.split(';')
game_max_red = 0
game_max_green = 0
game_max_blue = 0
game_power = 0
for set in sets:
@kaskajp
kaskajp / settings.json
Created February 21, 2024 20:37
Zed Config
{
"theme": "Rosé Pine",
"ui_font_size": 16,
"buffer_font_size": 14,
"inlay_hints": {
"enabled": false,
"show_type_hints": true,
"show_parameter_hints": true,
"show_other_hints": true
},