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 / 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 / convert_to_favicon.sh
Created January 26, 2019 10:50
convert image file to .ico icon favicon in linux (perhaps works on mac as well) with imagemagick convert
#!/usr/bin/env bash
set -ex
input_image=$1
output_image=$2
## Example usage: ./convert_to_favicon.sh icon.svg favicon.ico
for d in 16 32; do
convert -resize ${d}x${d} -flatten -colors 256 ${input_image} /tmp/favicon-${d}.ico
done
@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
@Jim-Holmstroem
Jim-Holmstroem / docker_debug.sh
Created May 29, 2015 13:03
docker debug wrapper, intended to be used with ubuntu:14.04 base image. It's easy to change what is to be included. It compiles a debug layer on top of the image specified and then runs it with -it bash. Add it to .bashrc if you want to have it in all your terminal sessions (ubuntu host specific). In it's current form (easy to change) it require…
function docker_debug { ([[ "$1" =~ ":" ]] || (echo "Failed. Specify tag" && false)) && echo -e "FROM $1\nUSER root\nRUN apt-get install --assume-yes ipython htop tcptrack tmux man\nRUN pip install cqlsh" | docker build -t $1-dbg - && docker run -it ${*:2} $1-dbg bash;};
@Jim-Holmstroem
Jim-Holmstroem / json_filter.py
Created May 20, 2015 14:32
Filter the keys from first level of a json. Used like "curl yad.da/api/something | ./filter_json.py wanted_key_1 wanted_key_2"
#!/usr/bin/env python
from __future__ import print_function, division
from operator import itemgetter
import sys
import json
def json_filter(filter_keys, data):
@Jim-Holmstroem
Jim-Holmstroem / README.markdown
Last active August 29, 2015 14:13
easy setup for deis 1.2.0

Install client and ctl

mkdir -p ~/bin
cd ~/bin
curl -sSL http://deis.io/deisctl/install.sh | sh -s 1.2.0
curl -sSL http://deis.io/deis-cli/install.sh | sh -s 1.2.0

(optional) install for all users

@nioto
nioto / PiCameraStream
Created March 4, 2014 10:14
Simple MJpeg streamer for Raspberri Pi Camera
#!/usr/bin/python
'''
A Simple mjpg stream http server for the Raspberry Pi Camera
inspired by https://gist.github.com/n3wtron/4624820
'''
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
import io
import time
import picamera
@rdb
rdb / js_linux.py
Last active April 8, 2024 10:12
Access joysticks/game controllers from Python in Linux via the joystick driver. See https://discourse.panda3d.org/t/game-controllers-on-linux-without-pygame/14128
# Released by rdb under the Unlicense (unlicense.org)
# Based on information from:
# https://www.kernel.org/doc/Documentation/input/joystick-api.txt
import os, struct, array
from fcntl import ioctl
# Iterate over the joystick devices.
print('Available devices:')
@mattiaslundberg
mattiaslundberg / arch-linux-install
Last active March 29, 2024 08:38
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
@simonlc
simonlc / life.js
Created October 14, 2012 16:01
HTML5 Conway's Game of Life
// Conway's Game of Life for HTML5 Canvas
// By Simon Laroche
var FPS = 5;
var paused = true;
var gameStarted = false;
var gLoop;
var generations = 0;
var population = 0;