Skip to content

Instantly share code, notes, and snippets.

View mhdzli's full-sized avatar
💭
The most important and daring kind of freedom is to be what you really are.

M.Zeinali mhdzli

💭
The most important and daring kind of freedom is to be what you really are.
View GitHub Profile
@mhdzli
mhdzli / instructions.md
Created November 4, 2022 13:08 — forked from jdmar3/instructions.md
Simple Slurm configuration in Debian based systems

Slurm Configuration Debian based Cluster

Here I will describe a simple configuration of the slurm management tool for launching jobs in a really simplistic cluster. I will assume the following configuration: a main node (for me it is an Arch Linux distribution) and 3 compute nodes (for me compute nodes are Debian VMs). I also assume there is ping access between the nodes and some sort of mechanism for you to know the IP of each node at all times (most basic should be a local NAT with static IPs)

Basic Structure

Slurm management tool work on a set of nodes, one of which is considered the master node, and has the slurmctld daemon running; all other compute nodes have the slurmd daemon. All communications are authenticated via the munge service and all nodes need to share the same authentication key. Slurm by default holds a journal of activities in a directory configured in the slurm.conf file, however a Database management system can be set. All in all what we will try to do is:

  • Install `munge
@mhdzli
mhdzli / stdin
Created May 13, 2021 07:29 — forked from sochotnicky/stdin
stdin
diff --git a/main.c b/main.c
index f979e24..2f54043 100644
--- a/main.c
+++ b/main.c
@@ -628,6 +628,7 @@ int main(int argc, char *argv[]) {
zwlr_layer_surface_v1_add_listener(
state.layer_surface, &layer_surface_listener, &state);
zwlr_layer_surface_v1_set_anchor(state.layer_surface, anchor);
+ zwlr_layer_surface_v1_set_size( state.layer_surface, 2560, 1440 );
zwlr_layer_surface_v1_set_margin(state.layer_surface,
@mhdzli
mhdzli / persianumber.js
Created September 27, 2020 05:56
persian number with javascript
<script>
$(document).ready(function () {
ConvertNumberToPersion();
});
function ConvertNumberToPersion() {
persian = { 0: '۰', 1: '۱', 2: '۲', 3: '۳', 4: '۴', 5: '۵', 6: '۶', 7: '۷', 8: '۸', 9: '۹' };
function traverse(el) {
@mhdzli
mhdzli / toggletouch
Created August 2, 2020 06:19
Toggle touchpad in sway
#!/bin/bash
TOUCHPAD_ID="$(swaymsg -t get_inputs | grep 'identifier.*Touchpad' | cut -d'"' -f4)" #give me the touchpad identifier
STATE="$(swaymsg -t get_inputs | jq .[0].libinput.send_events)" #check if touchpad is enabled
[ "$STATE" = '"enabled"' ] && swaymsg input "$TOUCHPAD_ID" events disabled || swaymsg input "$TOUCHPAD_ID" events enabled
@mhdzli
mhdzli / spectrbar
Last active May 18, 2020 12:28
spectrwm
#!/bin/bash
# baraction.sh for spectrwm status bar
trap 'update' 5
## DATE
dte() {
dte="$(date +"%A, %B %d %l:%M%p")"
echo -e "$dte"
}
@mhdzli
mhdzli / VAAPI-hwaccel-encode-Linux-Ffmpeg&Libav-setup.md
Created March 30, 2020 07:53 — forked from Brainiarc7/VAAPI-hwaccel-encode-Linux-Ffmpeg&Libav-setup.md
This gist contains instructions on setting up FFmpeg and Libav to use VAAPI-based hardware accelerated encoding (on supported platforms) for H.264 (and H.265 on supported hardware) video formats.

Using VAAPI's hardware accelerated video encoding on Linux with Intel's hardware on FFmpeg and libav

Hello, brethren :-)

As it turns out, the current version of FFmpeg (version 3.1 released earlier today) and libav (master branch) supports full H.264 and HEVC encode in VAAPI on supported hardware that works reliably well to be termed "production-ready".

@mhdzli
mhdzli / neoito-hub_wasp_ni.sh
Created March 4, 2020 07:19
Nativescript Installer installs nativescript for Android development on Ubuntu.
#!/usr/bin/env bash
# Synopsis : Script for installing Nativescript on Ubuntu 16.04
# config parameters
CURR_DIR="$PWD"
# Start of functions
printBanner() {
while read; do
@mhdzli
mhdzli / sway-interactive-screenshot
Last active March 1, 2020 17:36
Easy screenshots in Sway using dmenu
#!/bin/bash
# `list_geometry` returns the geometry of the focused of visible windows. You can also get they title
# by setting a second argument to `with_description`. The geometry and the title are seperated by `\t`.
#
# Arguments:
# $1: `focused` or `visible`
# $2: `with_description` or nothing
#
# Output examples:
@mhdzli
mhdzli / getxkblayout.c
Last active January 16, 2021 18:26 — forked from fikovnik/getxkblayout.c
Get keyboard layout using X11
// compile with `gcc -I/usr/include getxkblayout.c -lX11 -lxkbfile`
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/XKBlib.h>
#include <X11/extensions/XKBrules.h>
int main(int argc, char **argv) {
Display *dpy = XOpenDisplay(NULL);
@mhdzli
mhdzli / tlp-info
Last active February 19, 2020 20:57
Asus ZenBook 14 UX410UFR 1.0
$ sudo tlp-stat -s -b
--- TLP 1.3.1 --------------------------------------------
+++ System Info
System = ASUSTeK COMPUTER INC. 1.0 ZenBook 14 UX410UFR
BIOS = UX410UFR.201
Kernel = 5.5.3-arch1-1 #1 SMP PREEMPT Tue, 11 Feb 2020 15:35:41 +0000 x86_64
/proc/cmdline = BOOT_IMAGE=/vmlinuz-linux root=UUID=805eb372-94c7-4e8c-87b4-54b0414fa84a rw loglevel=3 quiet
Init system = systemd
Boot mode = UEFI