Skip to content

Instantly share code, notes, and snippets.

View mjnaderi's full-sized avatar
📖
Always Learning...

Mohammad Javad Naderi mjnaderi

📖
Always Learning...
View GitHub Profile
# You can run this turing machine in https://turingmachine.io/
name: Print three strokes
source code: |-
# Print three strokes
# Demo for this talk: https://querateam.github.io/talks/presentations/Theory-of-Computation-1
input: ''
blank: 0
start state: s1
table:
s1:
# You can run this turing machine in https://turingmachine.io/
name: determine parity
source code: |-
# Determine Parity
# Demo for this talk: https://querateam.github.io/talks/presentations/Theory-of-Computation-1/
input: '11111'
blank: 0
start state: s1
table:
s1:
# You can run this turing machine in https://turingmachine.io/
name: multiply by two
source code: |-
# Multiply by two
# Demo for this talk: https://querateam.github.io/talks/presentations/Theory-of-Computation-1/
input: '1111'
blank: 0
start state: s1
table:
s1:
# You can run this turing machine in https://turingmachine.io/
name: sum of two positive integers
source code: |+
# Sum of two positive integers
# Demo for this talk: https://querateam.github.io/talks/presentations/Theory-of-Computation-1/
input: '111110111'
blank: 0
start state: s1
table:
s1:
@mjnaderi
mjnaderi / README.md
Created January 10, 2022 08:36
Compressed model field for Django

Please note that storing compressed binary values inside database has its own disadvantage. According to my experience using PostgreSQL, it increased the size of custom-format dump (pg_dump -Fc) by 60%.

@mjnaderi
mjnaderi / gitlab_migrate.py
Last active August 9, 2022 17:50
Migrate from gitlab.com to self-hosted gitlab
"""
We used this script to migrate from gitlab.com to our self-hosted gitlab.
Author: Mohammad Javad Naderi
Before running the script, install `python-gitlab` package.
Important Note:
In order to keep the authors of merge requests and comments, before running this script make
sure all users have enabled "Public Email" in their gitlab.com profile and create account for
all users in self-hosted Gitlab (with the same e-mail address as their gitlab.com public email).
from django.contrib.auth.models import Permission
from django.db.models.deletion import ProtectedError
from django.contrib.contenttypes.models import ContentType
from django.db.models.deletion import Collector
def get_dependencies(obj):
collector = Collector(using="default")
collector.collect([obj])
return collector.data
@mjnaderi
mjnaderi / mnemonic-words.md
Last active March 23, 2023 17:29 — forked from fogleman/words.md
Mnemonic Encoding Word List
@mjnaderi
mjnaderi / disk-partitions.drawio
Last active March 28, 2024 13:19
install-arch images
<mxfile host="app.diagrams.net" modified="2023-07-04T12:36:48.192Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.51" etag="U4EHGn_sUU4WP-Eq_T0W" version="21.5.2" type="device">
<diagram name="Page-1" id="_bH2DKaN5ft4xbLNmIXA">
<mxGraphModel dx="989" dy="580" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="KdqZW1nxa3IcIuYSCLVA-135" parent="0" />
<mxCell id="KdqZW1nxa3IcIuYSCLVA-362" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#E8E8E8;strokeColor=#828282;container=1;imageAspect=1;recursiveResize=0;fontFamily=sans-serif;" parent="KdqZW1nxa3IcIuYSCLVA-135" vertex="1">
<mxGeometry x="700" y="800" width="140" height="130" as="geometry" />
</mxCell>
<mxCell id="KdqZW1nxa3IcIuYSCLVA-357" value="Logical Volume" style="rou