Skip to content

Instantly share code, notes, and snippets.

Avatar
📖
Always Learning...

Mohammad Javad Naderi mjnaderi

📖
Always Learning...
View GitHub Profile
@mjnaderi
mjnaderi / mnemonic-words.md
Last active February 26, 2023 16:37 — forked from fogleman/words.md
Mnemonic Encoding Word List
View mnemonic-words.md
View find_unused_django_content_types.py
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 / test.json
Created September 21, 2022 11:19
django-qsessions code coverage
@mjnaderi
mjnaderi / gitlab_migrate.py
Last active August 9, 2022 17:50
Migrate from gitlab.com to self-hosted gitlab
View gitlab_migrate.py
"""
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).
@mjnaderi
mjnaderi / README.md
Created January 10, 2022 08:36
Compressed model field for Django
View README.md

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%.

View turing-sum-of-two-positive-integers.yaml
# 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:
View turing-multiply-by-two.yaml
# 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:
View turing-determine-parity.yaml
# 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:
View turing-print-3-strokes.yaml
# 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:
View with-antd.js
/* eslint-disable no-param-reassign, consistent-return, no-restricted-syntax */
// Source: https://github.com/solidzoro/next-plugin-antd-less (Adapted to Webpack 5)
const clone = require("clone");
const fs = require("fs");
const lessToJS = require("less-vars-to-js");
// fix: prevents error when .less files are required by node
if (typeof require !== "undefined") require.extensions[".less"] = () => {};
module.exports = (