Skip to content

Instantly share code, notes, and snippets.

View nimatrueway's full-sized avatar
🤩

Naeim Taheri nimatrueway

🤩
View GitHub Profile
@nimatrueway
nimatrueway / app-2.11_Controller01.scala
Last active January 4, 2017 10:50
An example that demonstrates how asynchronous mechanism in Scala should and should not be used.
package ir.taheri
import play.api.mvc._
import scala.concurrent._
import ExecutionContext.Implicits.global
class Controller01 {
def method01 = Action.async {
Future {
@nimatrueway
nimatrueway / FutureExperiment.scala
Last active January 4, 2017 09:38
Playing with ForkJoinPool of ExecutionContext.Implicits.global and inspecting its behavior when "blocking {}" is not used when advised to.
import java.util.concurrent.Executors
import scala.concurrent._
import scala.concurrent.duration._
import ExecutionContext.Implicits.global
object FutureExperiment extends App {
val cores = Runtime.getRuntime.availableProcessors
val start = System.currentTimeMillis()
@nimatrueway
nimatrueway / LsSimulator.scala
Created October 12, 2017 06:45
An implementation of ls -l in Scala
import java.io.File
import java.nio.file.attribute.{PosixFilePermission, PosixFileAttributes}
import java.nio.file.{Files, Path}
import java.time.format.DateTimeFormatter
import java.time.{LocalDateTime, ZoneId}
/*
A solution for assignment #1
Nima Taheri ([email protected])
*/
@nimatrueway
nimatrueway / article-style.css
Last active May 19, 2019 11:06 — forked from bangedorrunt/article-style.css
GoldenDict Dracula Theme
// gnome rtl fix
div.bglrtl {
padding-right: 30px;
padding-left: 30px;
}
html {
background: #2B2B2B;
}
@nimatrueway
nimatrueway / PathParser.java
Last active December 14, 2017 11:55
XML and SVG-Path parser sample for scala-guide assignment#2 | http://engineering.pintapin.com/1396/06/30/scala-quick-guide/
package engine;
import java.awt.geom.Path2D;
import java.awt.geom.Point2D;
import java.util.LinkedList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* PathParser adopted from react-native-svg renderer written for android
@nimatrueway
nimatrueway / subtitle-overlap-fixer.go
Last active May 2, 2024 13:57
Little tool to fix overlapping subtitles (especially the ones extracted from english auto-subtitles of youtube, vtt files that you would convert to srt with ffmpeg)
package main
import (
"time"
"regexp"
"bufio"
"strconv"
"fmt"
"os"
"errors"
@nimatrueway
nimatrueway / app.js
Created May 7, 2018 19:50
Puppeteer Shahrzad Link Extractor
import puppeteer from 'puppeteer'
import fs from "fs";
import util from "util";
let url = 'https://lotusplay.com/episode/533/1574ce';
let domain = 'lotusplay.com';
let cookieDumpFile = '/home/nima/cookies.txt';
let browserAgent = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0';
let DEBUG = false;
let USE_COOKIE_AND_AGENT = true;
@nimatrueway
nimatrueway / install.sh
Last active September 14, 2023 05:52
Install uGet Download Manager on macOS
# Warning: INCOMPLETE, GTK has problems !
brew install intltool pkg-config gtk+3 libnotify gstreamer openssl
# install gnu xgettext
export GETTEXT_VERSION=$(curl https://ftp.gnu.org/pub/gnu/gettext/ | grep -oP 'gettext-[0-9.]+(?=.tar.gz)' | sort | tail -n 1)
wget "http://ftp.gnu.org/pub/gnu/gettext/$GETTEXT_VERSION.tar.gz"
tar -zxvf "$GETTEXT_VERSION.tar.gz"
cd "$GETTEXT_VERSION"
./configure
make
;-------------------------------------------------------------------------------
; 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
@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