Skip to content

Instantly share code, notes, and snippets.

View Jim-Holmstroem's full-sized avatar
💭
Coding

Jim Holmström Jim-Holmstroem

💭
Coding
View GitHub Profile
@Jim-Holmstroem
Jim-Holmstroem / d2s_checksum.py
Last active January 31, 2024 00:54
Checksum for diablo 2 files .d2s in python (todo insert the checksum into the file)
import numpy as np
"""
code to replicate:
static int d2charsave_checksum(unsigned char const *data, unsigned int len, unsigned int offset)
{
int checksum;
unsigned int i;
unsigned int ch;
@Jim-Holmstroem
Jim-Holmstroem / numpy_array_hash.py
Created February 21, 2012 10:51
Hash numpy.array
from hashlib import sha1
import numpy
arr=numpy.zeros((256,256,4))
sha1(arr)
@Jim-Holmstroem
Jim-Holmstroem / new_pair.sh
Created January 14, 2015 17:25
Create a second key-pair for SSH
ssh-keygen -t rsa -f .ssh/id_rsa_name
@Jim-Holmstroem
Jim-Holmstroem / externally_tagged_enum.js
Created September 14, 2022 21:33
serializer and deserializer for javascript for externally tagged enum
const gps = {
type: "gps",
long: 234,
lat: 344
};
const kmm = {
type: "kmm",
km: 34,
m: {
@Jim-Holmstroem
Jim-Holmstroem / main.hs
Last active April 5, 2021 07:35
Simple and Hacky Stack Machine in Haskell
{-# LANGUAGE OverloadedStrings #-}
import Prelude hiding (Word)
import Data.Maybe
data Stack a = Stack [a] deriving
(Show)
empty :: Stack a
empty = Stack []
@Jim-Holmstroem
Jim-Holmstroem / parquet_fix_pandas.py
Last active March 6, 2021 16:44
fix parquet read format to be pandas-like
from itertools import repeat
import pandas as pd
df = pd.DataFrame(
{
'accountData': [
[{'key': 'name' ,'value': 'jim'}, {'key': 'schlong' ,'value': '27' }],
[{'key': 'name' ,'value': 'cnagy'}, {'key': 'schlong' ,'value': '26' }],
@Jim-Holmstroem
Jim-Holmstroem / poetry_entrypoint.sh
Last active December 10, 2020 22:18
poetry entrypoint to be able to just run a command within the poetry shell (like pytest in CI or something similar). Makes `poetry shell` actually behave like a shell and can be used as ENTRYPOINT in a docker container and it wil behave like a bash entrypoint
#!/usr/bin/env bash
COMMAND=$@
set -x
command -v poetry > /dev/null || (echo missing poetry && exit 3)
if [[ -v ${COMMAND} ]]; then
poetry shell
else
bash -c ". .venv/bin/activate && $(printf ' %q' "$@")"
import threading
import time
import schedule
import json
import requests
def start_updater():
def _f():
while True:
@Jim-Holmstroem
Jim-Holmstroem / gist:2268d86d2aa05c7c9a97c3d15104f3f5
Created March 23, 2020 21:59
AI Discord Hangout - Social Social Distancing
Lets have a Discord hangout!
I've added so that anyone can create a voice channel and break out into the discussions
you feel are interesting. See it as if it was happening at a cafe, use common sense.
We'll try to share screens and show of what we are working on or have got stuck on,
or why not discuss why you think U-Net is the only network you'll ever need for segmentation?
I have no clue how this is going to turn out, but I'm optimistic that we'll make it work and
make it a bit better foreach run.
@Jim-Holmstroem
Jim-Holmstroem / fix.sh
Created April 4, 2017 21:03
arch linux auto connect to wifi problems (and fix) #rpi #raspberry. Had som issue with that the raspberry pi would not auto connect to the WiFi network, dispite that it worked when I started it manually. The below commands fixed it
sudo pacman -S polkit wpa_actiond
systemctl enable netctl-auto@wlan0.service