Skip to content

Instantly share code, notes, and snippets.

View jabbalaci's full-sized avatar

Laszlo Szathmary jabbalaci

View GitHub Profile
from pydub import AudioSegment
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtMultimedia import *
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
import sys
import time
import math
@jabbalaci
jabbalaci / garden_puzzle_z3.py
Created December 23, 2018 14:53 — forked from shahrilnet/garden_puzzle_z3.py
Using Z3 Theorem Solver to solve for Gardens Puzzle
import sys
import itertools
from z3 import *
#
# Original puzzle
#
'''
Five friends have their gardens next to one another, where they grow three kinds of crops:
@jabbalaci
jabbalaci / colors.nim
Last active September 3, 2023 11:48
A small program to make using 256 colors in Nim less painful.
import strformat
# A small program to make using 256 colors in Nim less painful.
# Original ZSH version from:
# P.C. Shyamshankar <[email protected]>
# Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
#
# Nim rewrite by Laszlo Szathmary <[email protected]>
# thanks to narimiran and kickeroo for making the code more idiomatic Nim code
#

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@jabbalaci
jabbalaci / dokidoki.py
Created January 18, 2018 22:13
Extract text that is hidden in an image.
#!/usr/bin/env python3
"""
Extract data from http://users.atw.hu/std66/egyetem/monika.png .
It's from the game "Doki Doki Literature Club".
Tamás Sinku showed me this problem. He also described the
solution: take the middle of the image. A black pixel means 0,
while a white pixel means 1. Read it byte by byte and convert
it to text. You get a BASE64 string with some '\0' characters
@jabbalaci
jabbalaci / vs_code_for_python.txt
Last active April 9, 2025 08:06
Visual Studio Code settings for Python development
Corresponding video: https://www.youtube.com/watch?v=XVQ5drokE6E (in Hungarian)
settings.json
=============
{
"workbench.colorTheme": "Default Light+",
"editor.fontSize": 18,
"editor.minimap.enabled": true,
"python.linting.pylintEnabled": false,
#!/usr/bin/env python3
# coding: utf8
"""
A simple wrapper for the `mailx` command.
Purpose
-------
Send an email notification to yourself from a Python script.
@jabbalaci
jabbalaci / image_url.py
Created October 20, 2015 09:32
test if a URL is an image or not
#!/usr/bin/env python2
# encoding: utf-8
"""
test if a URL is an image or not
"""
from __future__ import (absolute_import, division,
print_function, unicode_literals)
@jabbalaci
jabbalaci / pyvideo_popularity.py
Created April 19, 2015 11:10
pyvideo popularity
#!/usr/bin/env python3
# encoding: utf-8
"""
I saw a similar script on the homepage of Miguel Grinberg (the Flask book guy),
but he was using webscraping. Here I use simple API calls instead.
The script takes the presentations of a Python conference and orders the
presentations in descending order by the number of youtube views. It
is an indicator about the popularity of a video.
@jabbalaci
jabbalaci / gist:5820d1843e0e4317e37d
Last active February 18, 2018 09:27
freely available Linux Voice issues
# moved to https://github.com/jabbalaci/Linux-Voice-issues