Skip to content

Instantly share code, notes, and snippets.

View niittymaa's full-sized avatar

Sakari Niittymaa niittymaa

View GitHub Profile
@niittymaa
niittymaa / wp
Created February 20, 2024 22:35 — forked from lamyj/wp
Convert between Windows path and Linux path in WSL
#!/usr/bin/env python
from __future__ import print_function
import argparse
import json
import re
import subprocess
import sys
@niittymaa
niittymaa / playaudio.ps1
Created March 16, 2023 11:00 — forked from coderofsalvation/playaudio.ps1
hasslefree playing mp3 wav audio in Windows 10 WSL
#!/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -noexit
# Play a single file
# Usage:
# LINUX: timeout 5 ./playaudio.ps1 "c:\Users\Leon\Downloads\bensound-allthat.mp3" &>/dev/null &
# CMD.EXE: powershell.exe -noexit ./playaudio.ps1 "c:\Users\Leon\Downloads\bensound-allthat.mp3"
Add-Type -AssemblyName presentationCore
$mediaPlayer = New-Object system.windows.media.mediaplayer
$mediaPlayer.open( $args[0] )
$mediaPlayer.Play()

Conda Commands

Install Anaconda Link: https://www.continuum.io/downloads

  1. Check/List installed packages:
    Conda list

  2. Upgrade Conda packages:
    conda upgrade conda conda upgrade --all

@niittymaa
niittymaa / live_loss_plot_keras.ipynb
Created February 25, 2023 10:20 — forked from stared/live_loss_plot_keras.ipynb
Live loss plot for training models in Keras (see: https://github.com/stared/livelossplot/ for a library)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@niittymaa
niittymaa / gist:94d6249b91986afca562366fe417cd44
Created February 13, 2023 00:31 — forked from deespater/gist:5395192
Alphabets in different European languages
<?php
$l = range('a', 'z');
$alphabets = array(
'en' => $l,
'fr' => array_merge($l, array('é', 'à', 'è', 'ù', 'â', 'ê', 'î', 'ô', 'û', 'ç', 'ë', 'ï', 'ü', 'ÿ', 'æ', 'œ')),
'de' => array_merge($l, array('ä', 'ö', 'ü', 'ß')),
'es' => array_merge($l, array('ñ', 'ü', 'ch', 'll')),
'it' => array_merge($l, array('à', 'è', 'é', 'ì', 'í', 'î', 'ò', 'ó', 'ù', 'ú')),
'pt' => array_merge($l, array('á', 'â', 'ã', 'à', 'ç', 'é', 'ê', 'í', 'ó', 'ô', 'õ', 'ú', 'ü')),
'el' => array('α', 'β', 'γ', 'δ', 'ε', 'ζ', 'η', 'θ', 'ι', 'κ', 'λ', 'μ', 'ν', 'ξ', 'ο', 'π', 'ρ', 'σ', 'τ', 'υ', 'φ', 'χ', 'ψ', 'ω'),
@niittymaa
niittymaa / Unicode table
Created February 13, 2023 00:08 — forked from ivandrofly/Unicode table
Unicode table - List of most common Unicode characters *
Unicode table - List of most common Unicode characters *
* This summary list contains about 2000 characters for most common ocidental/latin languages and most printable symbols but not chinese, japanese, arab, archaic and some unprintable.
Contains character codes in HEX (hexadecimal), decimal number, name/description and corresponding printable symbol.
What is Unicode?
Unicode is a standard created to define letters of all languages ​​and characters such as punctuation and technical symbols. Today, UNICODE (UTF-8) is the most used character set encoding (used by almost 70% of websites, in 2013). The second most used character set is ISO-8859-1 (about 20% of websites), but this old encoding format is being replaced by Unicode.
How to identify the Unicode number for a character?
Type or paste a character:
@niittymaa
niittymaa / publish_python.md
Created February 11, 2023 07:57 — forked from ForgottenUmbrella/publish_python.md
How to publish Python apps for human beings

How to publish Python apps for human beings

So, you've created a Python app (be it a graphical user interface with Qt or the like, or a simple command line interface). Great! But how are others going to use it? Python applications often have dependencies (e.g. from third-party modules), and they also need a Python interpreter to run them. For a developer, installing all the necessary bits and bobs to make things work is okay, but that's unacceptable for a normal user - they just want to download the thing and run it.

Below are simple instructions to publish your app on the three main operating systems: Windows, macOS and Linux.

@niittymaa
niittymaa / min-char-rnn.py
Created February 5, 2023 21:05 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@niittymaa
niittymaa / install_anaconda.md
Created January 17, 2023 17:51 — forked from kauffmanes/install_anaconda.md
Install Anaconda on Windows Subsystem for Linux (WSL)

Thanks everyone for commenting/contributing! I made this in college for a class and I no longer really use the technology. I encourage you all to help each other, but I probably won't be answering questions anymore.

This article is also on my blog: https://emilykauffman.com/blog/install-anaconda-on-wsl

Note: $ denotes the start of a command. Don't actually type this.

Steps to Install Anaconda on Windows Ubuntu Terminal

  1. Install WSL (Ubuntu for Windows - can be found in Windows Store). I recommend the latest version (I'm using 18.04) because there are some bugs they worked out during 14/16 (microsoft/WSL#785)
  2. Go to https://repo.continuum.io/archive to find the list of Anaconda releases
  3. Select the release you want. I have a 64-bit computer, so I chose the latest release ending in x86_64.sh. If I had a 32-bit computer, I'd select the x86.sh version. If you accidentally try to install the wrong one, you'll get a warning in the terminal. I chose `Anaconda3-5.2.0-Li
@niittymaa
niittymaa / DeMagicEye.py
Created March 9, 2021 20:27 — forked from kscottz/DeMagicEye.py
Generate a depth map from a "Magic Eye" random dot autostereogram.
from SimpleCV import Image, Display, Color
from multiprocessing import Process, Queue
import numpy as np
import cv2
import copy
import sys
# caclulate the value of a row
# using the integral image
def idxToSum(x1,x2,y,integral):
# assume x2 > x1