Skip to content

Instantly share code, notes, and snippets.

View palesz's full-sized avatar

Andras Palinkas palesz

  • Toronto, Canada
View GitHub Profile
@palesz
palesz / libgen-download.fish
Created October 20, 2022 15:39
Download from libgen
function libgen-url --description 'generate a libgen search url from the passed in string'
echo 'https://libgen.is/search.php?req='(string escape --style=url (string join ' ' $argv))'&lg_topic=libgen&open=0&view=simple&res=25&phrase=1&column=def'
end
function libgen
lynx (libgen-url $argv)
end
function libgen-download
set download_options (string split ' ' (curl -XGET (libgen-url $argv) 2>/dev/null | grep -o '<a.*\[1\]</a>' | grep -o 'http[^\'"]\+'))
@palesz
palesz / recovery.go
Last active April 21, 2024 13:38
Navidrome password recovery
package main
// Usage:
// copy this code to https://replit.com/languages/go
// and change the encrypted_password variable below (see comments below for steps to acquite the encrypted password)
import (
"crypto/aes"
"crypto/cipher"
"encoding/base64"
@palesz
palesz / resolution.sh
Created October 15, 2020 17:42
Set a custom resolution using xrandr (even if the resolution currently does not exist)
#!/bin/sh
set -eux
width=${1:-2560}
height=${2:-1080}
newresandrate="$width $height 60"
modeline=`cvt $newresandrate | grep Modeline | sed 's/Modeline //g'`
@palesz
palesz / .zshrc
Created May 15, 2020 14:46
Change the zsh (or other shell) PROMPT to contain basic git status information
function git_status() {
if git status >/dev/null 2>/dev/null; then
status_str=`git status -s 2>/dev/null | cut -f1 -d' ' | uniq -c | awk '{ print $2 " " $1 }' | paste -s -d' '`
branch=`git branch --show-current`
commit_hash=`git log -1 --format=%h`
echo "[git: $commit_hash $branch $status_str]"
fi
}
# important (!)
sudo add-apt-repository ppa:wine/wine-builds && sudo apt-get update && sudo apt-get install --install-recommends winehq-devel
#!/bin/sh
# run this script using the
# wget -O - "https://gist.github.com/palesz/4a1d11df096a1bcd852878dc5e13b9ef/raw" | sh
# command
# change scale factor
dconf write /com/ubuntu/user-interface/scale-factor "{'eDP1': 13}"
# enable multiverse
sudo apt-add-repository multiverse && sudo apt-get update
@palesz
palesz / init.el
Last active December 16, 2016 15:20
Emacs package list
;; Package list I'm depending on and needs to make sure that it's installed
(setq my-package-list '(use-package
magit
org
cider
clj-refactor
parinfer
auto-complete
evil
@palesz
palesz / kwmrc
Created November 3, 2016 22:54
Kwm configuration for Mac OS
/*
This is a sample config for Kwm
The following statements can be used to set Kwms internal directory structure.
This is the root folder for Kwms files, the only thing this actually
specifies is the location of the 'init' script which Kwm runs upon startup.
Defaults to $HOME/.kwm
kwm_home /path/to/.kwm
@palesz
palesz / cljify.clj
Created October 6, 2016 00:11
Convert any arbitrary Java object hierarchy to Clojure map of maps
(ns cljify)
(require 'clojure.string)
(require 'clojure.walk)
(defn cljify1 [o]
(when (not (nil? o))
(let [cname (.getName (class o))
s (partial clojure.string/starts-with? cname)]
(cond
@palesz
palesz / dashboard-looper.html
Created January 20, 2016 04:01
Dashboard looper
<html>
<head>
<title>Dashboard Looper</title>
<script type="text/javascript">
var dashboards = [
{
"title": "Palesz.org",
"url": "http://palesz.org",
"delay": "5"
},