Skip to content

Instantly share code, notes, and snippets.

View nimatrueway's full-sized avatar
🤩

Naeim Taheri nimatrueway

🤩
  • Hootsuite
  • Coquitlam, BC, Canada
View GitHub Profile
@nimatrueway
nimatrueway / MigPaneExtensions.kt
Last active September 12, 2020 21:15 — forked from jschneider/MigPaneExtensions.kt
MigPane extension methods for TornadoFX
import javafx.event.EventTarget
import javafx.scene.Node
import org.tbee.javafx.scene.layout.fxml.MigPane
import tornadofx.attachTo
fun EventTarget.migPane(op: MigPane.() -> Unit = {}): MigPane {
return MigPane().attachTo(this, op)
}
var Node.cc: String
@nimatrueway
nimatrueway / Main.scala
Last active August 4, 2020 14:50
Runtime's session timezone possible problem
package classloaders
import java.time._
import java.util.TimeZone
import java.util.concurrent.TimeUnit
import scala.concurrent.duration.Duration
object Main {
@nimatrueway
nimatrueway / mendix-downloader.sh
Last active August 30, 2023 20:44
Mendix downloader for Linux/macOS/Unix
#!/bin/bash
#
# Description:
# downloads mendix of the specified version and places it in `$HOME/.mendix/{{specified-version}}`
#
# Usage:
# mendix-downloader.sh {{specify-the-desired-version}}
# (e.g. mendix-downloader.sh 7.23.7.55882)
#
MXBUILD_VERSION=$1
@nimatrueway
nimatrueway / mapAccumLeft.kt
Last active December 19, 2019 15:33
mapAccumLeft written in Kotlin
fun <E1, E2, R> mapAccumLeft(list: List<E1>, zero: R, accumulateAndMap: (R, E1) -> Pair<R, E2>): Pair<R, List<E2>> {
return list.fold(Pair(zero, mutableListOf<E2>())) {
(acc, mappedList), elem1 ->
val (newAcc, elem2) = accumulateAndMap(acc, elem1)
Pair(newAcc, mappedList.also { it.add(elem2) })
}
}
// sample usage
mapAccumLeft(listOf(1, 2, 3, 4), "A", { str, num -> Pair(str + num, num * 10) })
@nimatrueway
nimatrueway / v4l2loopback-install.sh
Last active May 13, 2020 06:29
Share a single screen (when having multi-screens) on slack through webcam (bad quality though)
#!/bin/bash
export V4L2L_DIR=$(mktemp -d)
sudo apt-get install git v4l-utils dialog libelf-dev
echo ========================================================================
echo == REMOVING ANY PREVIOUS INSTALLATION OF v4l2loopback ==================
echo ========================================================================
sudo apt-get purge v4l2loopback-dkms v4l2loopback-utils
find "/lib/modules/$(uname -r)" | grep v4l2loopback | sudo xargs rm -f
echo ========================================================================
@nimatrueway
nimatrueway / fuse-kde-neon-with-kubuntu-efi-boot.bash
Created March 28, 2019 20:47
Fix KDE Neon boot problem by replacing its boot-partition with Kubuntu's
#!/bin/bash
sudo apt-get install kpartx xorriso
# parameters to set before run
# download both kde-neon and kubuntu's image to fuse them (attach EFI+BootPartition to kde-neon's)
export KDE_NEON_IMG=/home/nima/neon-useredition-20190321-0530-amd64.iso
export KUBUNTU_IMG=/home/nima/kubuntu-18.04.2-desktop-amd64.iso
export KDE_NEON_NEW_IMG=$(basename $KDE_NEON_IMG | awk '{ gsub(/\.iso$/,"-modded.iso",$1); print $1 }')
export MOUNT=$(mktemp -d)
@nimatrueway
nimatrueway / classpath-conflict-test.sh
Last active September 21, 2020 09:21
Java classpath/classloaders binary conflict test
#!/bin/sh
rm -rf dir1 dir2;
mkdir -p dir1/pkg;
cat >File.java <<EOL
package pkg;
public class File {
public static void main(String[] args) {
System.out.println("dir1/File");
}
@nimatrueway
nimatrueway / my-linux.tools.md
Last active February 24, 2019 17:45
All My Desktop Linux Tools !

OS

@nimatrueway
nimatrueway / massren-nemo.py
Last active March 4, 2020 12:49
Integration Nemo file manager with massren for bulk renaming (https://github.com/laurent22/massren)
#!/usr/bin/env python3
from re import sub as rereplace, compile as recompile
from sys import argv
from urllib.parse import unquote
from subprocess import run
# prerequisites:
# make sure the editor you assigned to massren is assessible with default PATH (uninitialized .zshrc)
# constants
;-------------------------------------------------------------------------------
; Auto-Reload AutoHotkey when .ahk file is saved
; http://prxbx.com/forums/showthread.php?tid=1181
; Modified 2009-12-09 11:32:17 by Luke Scammell - luke {at} scammell [dot] co (.) uk
; Modified to match any window with .ahk in the title, meaning it will update other scripts as well and from other programs like Notepad++ :)
~^s::
SetTitleMatchMode, 2
FileGetTime ScriptStartModTime, %A_ScriptFullPath%
#If WinActive(A_ScriptName " ahk_exe Code.exe") ; change Code.exe with your ahk editor executable