Skip to content

Instantly share code, notes, and snippets.

📖
Always Learning...

Mohammad Javad Naderi mjnaderi

📖
Always Learning...
Block or report user

Report or block mjnaderi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mjnaderi
mjnaderi / AnkiCardTemplate.md
Last active Sep 17, 2019
Anki Card Template
View AnkiCardTemplate.md
  • Install "Syntax Highlighting for Code" plugin: https://ankiweb.net/shared/info/1463041493

  • In the plugin's options (Tools > Syntax Highlighting Options), set:

    • Line numbers
    • Center code fragments
    • Use CSS classes
  • Enter following HTML and CSS templates in Tools > Manage Note Types > Cards

View actlogger.sh
$ pacman -S xprintidle xdotool iw
$ while true; do idle=`xprintidle`; print `date` ' | ' 'Idle:' "$((idle/1000))s" ' | ' `xdotool getactivewindow getwindowname`; sleep 10; done
$ iw dev wlp2s0 info
@mjnaderi
mjnaderi / iran_cities.json
Created Dec 4, 2018
Iran Provinces and Cities (from http://gndb.ncc.org.ir/Pages/Search.aspx on 2018 Dec 4)
View iran_cities.json
[
{
"id": 1,
"province": "آذربایجان شرقی",
"cities": [
{
"name": "آبش احمد",
"phonetic": "Ābešahmad",
"longitude": "47.3171388",
"latitude": "39.04429447"
View custom_ps1.py
# To enable, set environment variable "PYTHONSTARTUP" to the path of this file
import sys
import datetime
class ClockPS1(object):
def __repr__(self):
now = datetime.datetime.now()
return '\033[92m{}\033[0m \033[95m\033[1m>>>\033[0m '.format(str(now.strftime("%H:%M:%S.%f"))[:-4])
@mjnaderi
mjnaderi / django-syslog.md
Created May 29, 2018
Logging to Syslog in Django
View django-syslog.md
@mjnaderi
mjnaderi / qownbidi.qml
Created May 12, 2018
A script for QOwnNotes to add RTL support
View qownbidi.qml
import QtQml 2.0
QtObject {
/**
* This function is called when the markdown html of a note is generated
*
* It allows you to modify this html
*
* @param {Note} note - the note object
* @param {string} html - the html that is about to being rendered
@mjnaderi
mjnaderi / install-arch.md
Last active Oct 10, 2019 — forked from mattiaslundberg/arch-linux-install
Install Arch Linux with Full Disk Encryption (LVM on LUKS)
View install-arch.md
@mjnaderi
mjnaderi / queval.js
Created Sep 26, 2015
Simple math expression evaluator based on jsep
View queval.js
var jsep = require('jsep');
(function (root) {
var COMPOUND = 'Compound',
IDENTIFIER = 'Identifier',
MEMBER_EXP = 'MemberExpression',
LITERAL = 'Literal',
THIS_EXP = 'ThisExpression',
CALL_EXP = 'CallExpression',
@mjnaderi
mjnaderi / backup.sh
Last active Aug 29, 2015
Save a backup of some small and important files in DEVICE when DEVICE is mounted
View backup.sh
# Save a backup of some small and important files in DEVICE when DEVICE is mounted
# This file should be placed in DEVICE itself
# TODO add rotation (.tar.gz)
# TODO use usbmount (or sth) to run this code instantly when one of BACKUP_DEVICES is mounted (instead of using cron)
################################### CONFIG ###################################
FILES_TO_BE_BACKED_UP="/home/mohammad/file1.txt
/home/mohammad/file2.txt"
You can’t perform that action at this time.