Skip to content

Instantly share code, notes, and snippets.

View mlliarm's full-sized avatar

Michail Liarmako. mlliarm

  • 09:31 (UTC +02:00)
View GitHub Profile
@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;
@mlliarm
mlliarm / Installing Python 3.7 from source on Ubuntu 18.04.md
Created January 12, 2022 23:56
Installing Python 3.7 from source on Ubuntu 18.04

Installing Python 3.7 from source on Ubuntu 18.04

# update system
sudo apt update && sudo apt upgrade -y

# install build tools and python prerequisites
sudo apt install build-essential libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev libffi-dev

# download and extract python
@mlliarm
mlliarm / weather.md
Last active January 10, 2022 23:21
A simple CLI script that tells the weather of any given location

Weather CLI app

What

A simple CLI script that tells the weather of any given location.

It uses the https://wttr.in/ service along with a curl.

Why

I love CLI GNU/Linux apps.

@mlliarm
mlliarm / whitney.c
Last active December 23, 2021 16:45 — forked from anonymous/gist:f72e5c4a432492abce59
Arthur Whitney's J interpreter, decompressed
// Link to the original: http://www.jsoftware.com/jwiki/Essays/Incunabulum
// Found at https://news.ycombinator.com/item?id=8533843
typedef char C;
typedef long I;
typedef struct a {
I t,r,d[3],p[2];
}* A;
@mlliarm
mlliarm / gist:261037e635c0b8942fd6b939e2608922
Created December 23, 2021 06:24 — forked from psayre23/gist:c30a821239f4818b0709
Runtime Complexity of Java Collections
Below are the Big O performance of common functions of different Java Collections.
List | Add | Remove | Get | Contains | Next | Data Structure
---------------------|------|--------|------|----------|------|---------------
ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array
LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List
CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array
@mlliarm
mlliarm / particles.lgt
Last active December 23, 2021 06:22 — forked from pmoura/particles.lgt
Logtalk version of particles.pl
% Source of the particles.pl: https://github.com/mlliarm/particleslogic/blob/master/src/particles.pl
:- object(particle).
% common properties to all particles
:- public([
boson/0, fermion/0,
mass/1, spin/1, lifetime/1, charge/1
]).
@mlliarm
mlliarm / clean_code.md
Last active December 23, 2021 06:20 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.

Bob Martin's book in Amazon.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid (KISS). Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.
@mlliarm
mlliarm / combinators_for_logic.hs
Created December 23, 2021 04:47
Combinators for logic programming (Haskell98)
-- Authors: Mike Spivey and Silvija Seres
-- Taken from: https://www.cs.ox.ac.uk/publications/books/fop/dist/fop/chapters/9/Logic.hs,
-- "The fun of programming book", https://www.cs.ox.ac.uk/publications/books/fop/,
-- Chapter 9, Combinators for logic programming
-- Haskell 98 compliant.
module Logic where
import List
-- Section 9.2