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 / java_fix.sh
Created September 15, 2017 14:23
Arch Linux: Solution for "command not found: javadoc" (even though java is marked as installed)
# Solves: "command not found: javadoc"
sudo pacman -S j{re,dk}8-openjdk
# Had some issues with java et al. after I changed from java7 to java8, not everything was relinked and placed properly, re-installing it solved it.
from __future__ import print_function, division
import random
import gym
import numpy as np
from collections import deque
from keras.models import Sequential
from keras.layers import Dense
from keras.optimizers import Adam
@Jim-Holmstroem
Jim-Holmstroem / apply_image_kernel.py
Created May 13, 2017 10:07
Apply image kernel on file and create another file
from __future__ import division, print_function
import numpy as np
import cv2
COLOR = 1
GRAYSCALE = 0
UNCHANGED = -1
@Jim-Holmstroem
Jim-Holmstroem / vu_meter.ino
Created May 3, 2017 20:49
Control anaog VU-meter from arduino (with calibraiations for my VU-meter)
void setup() {
Serial.begin(115200);
}
// 0=> 0
// 47=> 100
// 94=> 200
// 141=> 300 (still following 47 * n)
// 192=> 400 (1 mark off)
// 246=> 500 (2 mark off)
@Jim-Holmstroem
Jim-Holmstroem / vu_meter_controller.ino
Created April 30, 2017 16:52
small program to drive vu-meter, and some calibration values for a specific one
void setup() {
Serial.begin(115200);
}
// 0=> 0
// 47=> 100
// 94=> 200
// 141=> 300 (still following 47 * n)
// 192=> 400 (1 mark off)
@Jim-Holmstroem
Jim-Holmstroem / live_transformation.py
Created April 29, 2017 11:59
live transform opencv frame by frame
from __future__ import division, print_function
import cv2
id_ = lambda x: x
def live_transform(transformation=id_):
cap = cv2.VideoCapture(0)
while True:
ret, img = cap.read()
from time import time
import numpy as np
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
from sklearn.datasets import load_digits
from sklearn.decomposition import PCA
from sklearn.preprocessing import scale
digits = load_digits()
@Jim-Holmstroem
Jim-Holmstroem / mail.hs
Created April 14, 2017 20:53
haskell gmail stmp mail example
{-# LANGUAGE OverloadedStrings #-}
import Network.HaskellNet.IMAP.SSL
import Network.HaskellNet.SMTP.SSL as SMTP
import Network.HaskellNet.Auth (AuthType(LOGIN))
import qualified Data.ByteString.Char8 as B
username = "test.mailer@gmail.com"
@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
from keras import backend as K
K.set_image_dim_ordering('th')