Skip to content

Instantly share code, notes, and snippets.

Jabba Laci jabbalaci

View GitHub Profile
@jabbalaci
jabbalaci / garden_puzzle_z3.py
Created Dec 23, 2018 — forked from shahril96/garden_puzzle_z3.py
Using Z3 Theorem Solver to solve for Gardens Puzzle
View garden_puzzle_z3.py
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 Jan 25, 2019
A small program to make using 256 colors in Nim less painful.
View colors.nim
import strformat
import tables
# A small program to make using 256 colors in Nim less painful.
# Original ZSH version from:
# P.C. Shyamshankar <sykora@lucentbeing.com>
# Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
# Nim rewrite by Laszlo Szathmary <jabba.laci@gmail.com>
# thanks to narimiran and kickeroo for making the code more idiomatic Nim code
View gist:5d384ccb464c66de54fca535a80a5709

1. Clone your fork:

git clone git@github.com: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 / intellij-trial-reset.sh
Created Apr 7, 2018 — forked from denis111/intellij-trial-reset.sh
reset intellij idea 14 - 2017.x.x evaluation
View intellij-trial-reset.sh
#!/bin/bash
echo "removeing evaluation key"
rm ~/.IntelliJIdea15/config/eval/idea15.evaluation.key
echo "resetting evalsprt in options.xml"
sed -i '/evlsprt/d' ~/.IntelliJIdea15/config/options/options.xml
echo "resetting evalsprt in prefs.xml"
sed -i '/evlsprt/d' ~/.java/.userPrefs/prefs.xml
@jabbalaci
jabbalaci / dokidoki.py
Created Jan 18, 2018
Extract text that is hidden in an image.
View dokidoki.py
#!/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 Feb 16, 2018
Visual Studio Code settings for Python development
View vs_code_for_python.txt
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,
View email.py
#!/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 Oct 20, 2015
test if a URL is an image or not
View image_url.py
#!/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)
View pyvideo_popularity.py
#!/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 Feb 18, 2018
freely available Linux Voice issues
View gist:5820d1843e0e4317e37d
# moved to https://github.com/jabbalaci/Linux-Voice-issues
You can’t perform that action at this time.