Skip to content

Instantly share code, notes, and snippets.

View mlliarm's full-sized avatar

Michail Liarmakopoulos mlliarm

View GitHub Profile
@mlliarm
mlliarm / square_free_numbers.ijs
Last active September 27, 2022 03:55
Square free numbers
NB. This problem was read in the blogpost (https://www.glc.us.es/~jalonso/exercitium/numeros-libres-de-cuadrados/) of @Jose_A_Alonso.
NB. Problem statement: given a positive integer N, it's called square-free if no square number (eg 2^2, 11^11) can be created from its prime divisors.
NB. Created using the J903 online playground (https://jsoftware.github.io/j-playground/bin/html2/).
NB. Let's get the matrix of the prime divisors of an array of integers
q: @> 10 30 40 1000 11 121
NB. 2 5 0 0 0 0
NB. 2 3 5 0 0 0
NB. 2 2 2 5 0 0
NB. 2 2 2 5 5 5
@mlliarm
mlliarm / multi_keyboard_rasp64_debian11.md
Created April 18, 2022 10:17
Multiple keyboard layouts on RaspberryOS 64 bit, Debian Bullseye

Multiple keyboard layouts on RaspberryOS 64 bit, Debian Bullseye

Issue

The issue is that if one follows the usual steps, the keyboard layout handler doesn't change the layouts. It's a very well known issue.

Solution

From the above link, and most specifically this post, the solution is as follows:

@mlliarm
mlliarm / obf_gol.py
Created April 15, 2022 18:02
Obfuscated python for the Game of Life
# Credit to `oskar31415` from the r/APLjk discord server for sharing the code and his friend for writing it.
'''
Original code:
(lambda N,P:(lambda f,i:P.show(__import__('matplotlib.animation',fromlist=['FuncAnimation']).FuncAnimation(f,lambda i:[i.set_array((lambda g:(lambda n:N.logical_or(n==3,N.logical_and(g,n==2)))((N.sum([N.roll(N.roll(g,y,1),x,0)for x in(-1,0,1)for y in(-1,0,1)if x|y],0))))(i.get_array())),[i]][1],interval=0,blit=1)))(P.figure(),P.imshow(N.random.rand(200,400)<.2,)))(__import__("numpy"),__import__("matplotlib.pyplot")) 
'''
# Expanded by mlliarm@
import pdb
try:
@mlliarm
mlliarm / linux-email.md
Created March 3, 2022 08:18
Nice email clients for GNU/Linux
@mlliarm
mlliarm / youtube-cli.md
Last active March 2, 2022 12:12
Youtube from the Linux CLI

Youtube from the Linux CLI

I really love listening to music when programming, on my old Linux laptop.

So, to save resources I looked for a CLI Youtube app. And there is an amazing one.

Enter yewtube

  • Yewtube is a fork of mps-youtube. Find yewtube here. Follow the instructions in the README.md file to install it.
  • Suggestion: install it within a virtual environment (virtualenv).
@mlliarm
mlliarm / rss-twitter-hashtags.md
Last active March 27, 2024 02:55
How to use RSS to get updates from Twitter hashtags
@mlliarm
mlliarm / factoring.md
Last active February 25, 2022 06:21
Factoring 10...01

Factoring 10...01

Tools

GNU/Linux factor Bash tool and python3.

Code & results

# bash shell
 $ factor 101
@mlliarm
mlliarm / goodcode.cpp
Created February 11, 2022 18:17 — forked from Maltysen/goodcode.cpp
Good Code
//header
#pragma GCC target ("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;