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
@mjnaderi
mjnaderi / AnkiCardTemplate.md
Last active May 3, 2022 10:00
Anki Card Template
  • 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

# 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:
# 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: 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:
@mjnaderi
mjnaderi / actlogger.sh
Created January 25, 2019 14:51
Activity Logger
$ 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 December 4, 2018 15:59
Iran Provinces and Cities (from http://gndb.ncc.org.ir/Pages/Search.aspx on 2018 Dec 4)
[
{
"id": 1,
"province": "آذربایجان شرقی",
"cities": [
{
"name": "آبش احمد",
"phonetic": "Ābešahmad",
"longitude": "47.3171388",
"latitude": "39.04429447"
@mjnaderi
mjnaderi / queval.js
Created September 26, 2015 14:10
Simple math expression evaluator based on jsep
var jsep = require('jsep');
(function (root) {
var COMPOUND = 'Compound',
IDENTIFIER = 'Identifier',
MEMBER_EXP = 'MemberExpression',
LITERAL = 'Literal',
THIS_EXP = 'ThisExpression',
CALL_EXP = 'CallExpression',
@mjnaderi
mjnaderi / icedream-eclipse-theme.xml
Last active August 29, 2015 14:04
My Eclipse Color Theme (based on Schuss) to be used with Eclipse Color Theme Plugin
<?xml version="1.0" encoding="utf-8"?>
<colorTheme id="28852" name="IceDream" modified="2014-07-23 15:43:53" author="Mohammad Javad Naderi">
<searchResultIndication color="#DDDDDD" />
<filteredSearchResultIndication color="#DDDDDD" />
<occurrenceIndication color="#DDDDDD" />
<writeOccurrenceIndication color="#DDDDDD" />
<findScope color="#BCADAD" />
<deletionIndication color="#9b5656" bold="false" />
<sourceHoverBackground color="#EEEEEE" />
<singleLineComment color="#BBBBBB" italic="true" />
@mjnaderi
mjnaderi / .gtkrc-2.0
Created July 18, 2014 15:46
~/.gtkrc-2.0 Fix eclipse (Also use https://github.com/mjnaderi/eclipse-themes)
style "gtkcompact" {
# font_name="Liberation 8"
GtkButton::defaultborder={0,0,0,0}
GtkButton::defaultoutsideborder={0,0,0,0}
GtkButtonBox::childminwidth=0
GtkButtonBox::childminheigth=0
GtkButtonBox::childinternalpadx=0
GtkButtonBox::childinternalpady=0
GtkMenu::vertical-padding=0
GtkMenuBar::internalpadding=0