Skip to content

Instantly share code, notes, and snippets.

View hadisfr's full-sized avatar

H@di hadisfr

View GitHub Profile
@hadisfr
hadisfr / spin.md
Last active December 21, 2023 12:07
How to Use SPIN Model Checker

How to Use SPIN

Run Verifier

It's possible to use spin -a src.pml to create pan.[cbhmt] files. Then, it's possible to compile the generated verifier using gcc -o pan pan.c. The compiler verifier could be run by ./pan. spin -run src.pml automates the whole process.

Rerun After Failure

@hadisfr
hadisfr / Geeklets.md
Created October 30, 2019 11:26
GeekTool Geeklets Scripts
@hadisfr
hadisfr / add-p.md
Last active December 1, 2019 15:53 — forked from mattlewissf/add-p.md
Lightning Talk: Git add -p

git add -p is your friend

git add -p is basically "git add partial (or patch)"

Patch mode allows you to stage parts of a changed file, instead of the entire file. This allows you to make concise, well-crafted commits that make for an easier to read history. This feature can improve the quality of the commits. It also makes it easy to remove parts of the changes in a file that were only there for debugging purposes - prior to the commit without having to go back to the editor.

It allows you to see the changes (delta) to the code that you are trying to add, and lets you add them (or not) separately from each other using an interactive prompt. Here's how to use it:

from the command line, either use

  • git add -p
version: '2'
networks:
kafka:
driver: bridge
ipam:
config:
- subnet: 10.20.0.0/16
services:
@hadisfr
hadisfr / xsel.el
Last active June 18, 2020 10:55 — forked from ossdev-somewhere/xsel.el
Emacs-nox <-> X11 clipboard transfer
; You need "xsel" program.
(defun x-paste ()
"insert text on X11's clipboard to current buffer."
(interactive)
(insert (shell-command-to-string "xsel -b")))
(defun x-copy ()
"copy text on local kill-ring to X11's clipboard."
(interactive)
@hadisfr
hadisfr / install_jdk.sh
Created April 1, 2020 19:09
a script for installing jdk from tar file in Ubuntu
#!/usr/bin/env bash
if [[ $# != 1 ]]; then
echo -e "usage:\t$0 <url of Linux binary from https://jdk.java.net>"
exit 1
fi
if [ $EUID != 0 ]; then
sudo "$0" "$@"
exit $?
@hadisfr
hadisfr / .jdk-14.jinfo
Created April 13, 2020 21:50
/usr/lib/jvm/.jdk-14.jinfo to make update-java-alternatives work for Java SE (JDK, etc.) 14 installed from https://www.oracle.com/java/technologies/javase-jdk14-downloads.html
name=jdk-14
priority=1411
section=main
hl rmid /usr/lib/jvm/jdk-14/bin/rmid
hl java /usr/lib/jvm/jdk-14/bin/java
hl keytool /usr/lib/jvm/jdk-14/bin/keytool
hl jjs /usr/lib/jvm/jdk-14/bin/jjs
hl rmiregistry /usr/lib/jvm/jdk-14/bin/rmiregistry
hl jfr /usr/lib/jvm/jdk-14/bin/jfr
ZOOKEEPER_IP=esv4-hcl197.grid.linkedin.com
BOOTSTRAP_SERVER_IP=esv4-hcl198.grid.linkedin.com
# Producer
# Setup
bin/kafka-topics.sh --zookeeper $ZOOKEEPER_IP:2181 --create --topic test-rep-one --partitions 6 --replication-factor 1
bin/kafka-topics.sh --zookeeper $ZOOKEEPER_IP:2181 --create --topic test --partitions 6 --replication-factor 3
@hadisfr
hadisfr / pdftk_fix_pages_oriention.sh
Last active October 6, 2020 22:50
rotate vertical pages to horizontal in final pdf of a book
PAGES=(104-105 111-115 120)
pdftk src.pdf rotate `for PAGE in ${PAGES[@]}; do echo ${PAGE}oddleft ${PAGE}evenright; done` output dst.pdf
@hadisfr
hadisfr / pandoc_persian_md_html_convert.sh
Created October 6, 2020 22:41
pandoc persian tex html convert
pandoc report.md -o report.html --bibliography=biblio.bib --filter pandoc-crossref --filter pandoc-citeproc --csl ./acm.csl --resource-path=./img --self-contained