Skip to content

Instantly share code, notes, and snippets.

View hadi77ir's full-sized avatar

Mohammad Hadi Hosseinpour hadi77ir

View GitHub Profile
@hadi77ir
hadi77ir / Sci-Hub.js
Last active February 8, 2023 21:45
Zotero Translator for "Sci-Hub", uses Crossref API to fetch metadata on the work.
{
"translatorID": "39a0089f-bf4b-402e-b983-2673aaa4261c",
"label": "Sci-Hub",
"creator": "Mohammad Hadi Hosseinpour",
"target": "https?://sci\\-?hub.(se|com|ru|[A-z]{1,3})/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
@hadi77ir
hadi77ir / ttlmap_bench_test.go
Created October 16, 2022 18:12
Benchmark for implementations of "Expiring Map"/"TTL Map"/"Timed Map"/(Whatever you name it)
package benchmarkexpiremap
import (
"math/rand"
"strconv"
"testing"
"time"
"github.com/imkira/go-ttlmap"
"github.com/zekroTJA/timedmap"
@hadi77ir
hadi77ir / x0vncserver-run
Created March 7, 2021 22:42
Run x0vncserver with
#!/bin/bash
die() { echo "error: $@"; exit 1; }
(( EUID == 0 )) || die 'this must be run as root';
if [[ "$DISPLAY" == "" ]] ; then
# set display to :0
export DISPLAY=":0"
fi
if [[ "$XAUTHORITY" == "" ]] ; then
# try finding it out through Xorg arguments
export XAUTHORITY=$(pgrep -a Xorg | awk -F' ' '{ for(i = 1; i<=NF; i++) { if($i == "-auth") { i++; print $i; } } }')
@hadi77ir
hadi77ir / keybase.md
Created December 25, 2019 20:58
My Keybase.io proof

Keybase proof

I hereby claim:

  • I am hadi77ir on github.
  • I am hadi77ir (https://keybase.io/hadi77ir) on keybase.
  • I have a public key whose fingerprint is ED4B 73BD E845 AE04 AC46 36B4 5009 EF51 B7AC EC35

To claim this, I am signing this object:

@hadi77ir
hadi77ir / PKGBUILD
Last active May 26, 2020 03:18
PKGBUILD for building Arch Linux EasyEDA package (with Electron 3.1.8)
pkgname=easyeda
pkgver=2.0.0
pkgrel=0
pkgdesc="EasyEDA Desktop Client, A Simple and Powerful Electronic Circuit Design Tool"
arch=('x86_64')
license=(custom)
depends=(gconf)
url="https://easyeda.com/page/download"
options=('!strip')
source=('https://image.easyeda.com/files/easyeda-linux-64bit-latest.zip' 'https://github.com/electron/electron/releases/download/v3.1.8/electron-v3.1.8-linux-x64.zip')
@hadi77ir
hadi77ir / AssemblerEngine.cs
Last active November 5, 2018 09:35
Basic P/Invoke wrapper written in C# for Keystone Assembler Engine
using System;
using System.Runtime.InteropServices;
namespace NKeystone
{
/// <summary>
/// Represents a higher-level access to Keystone API.
/// </summary>
public class AssemblerEngine : IDisposable
{
http://www.instructables.com/id/Solder-USB-power-cable-to-Raspberry-Pi/
http://www.instructables.com/id/PiStation-A-Raspberry-Pi-Emulation-Console/
http://www.instructables.com/id/Raspberry-Pi-Wall-Mounted-Google-Calendar/
http://www.instructables.com/id/Raspberry-Pi-for-Amateur-Radio-VOIP-Echolink/
http://www.instructables.com/id/Raspberry-Pi-Cam-Tank-v10/
http://www.instructables.com/id/Gameboy-LCDRaspi-Upgrade/
http://www.instructables.com/id/Complete-DIY-Raspberry-Pi-Weather-Station-with-Sof/
http://www.instructables.com/id/Create-Your-Own-Solar-Powered-Raspberry-Pi-Weather/
http://www.instructables.com/id/Turn-any-printer-into-a-wireless-printer-with-a-Ra/
@hadi77ir
hadi77ir / gethls.bat
Created July 30, 2017 04:41
HLS Download Helper - Download HLS video streams using Wget and FFMPEG, without losing quality.
@echo off
php "%~dp0\gethls.php" %*
@hadi77ir
hadi77ir / change_brightness.sh
Created April 9, 2017 21:53
Changes display brightness (I use it on my ASUS G550JX) takes 2 parameters, a brightness percentage and device name. To find out your device name, run `ls /sys/class/backlight`.
#!/usr/bin/env bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
if (( $# < 1 ))
then echo "error not enough params"
exit
fi
if [ "$1" -lt 10 ]
@hadi77ir
hadi77ir / extract-zlib.pl
Created March 14, 2017 21:09
A little script for extacting compressed files, after dumping sections from "vmware-vmx" binary in order to get to VMware Phoenix BIOS firmware, VGA BIOS, etc. https://bart.motd.be/modifying-vmware-bios
#!/usr/bin/perl -w
use Compress::Zlib;
print $ARGV[0];
if(lc(substr($ARGV[0], length($ARGV[0]) - 2)) ne ".z"){
#print lc(substr($ARGV[0], length($ARGV[0]) - 2, 2));
die "Input must be a .Z compressed file.";
}
my $file_contents;
my $newfile = substr($ARGV[0], 0, length($ARGV[0]) - 2);