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 / 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 / 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 / BasicAuthAuthorizationInterceptor.java
Created August 23, 2012 16:13
Basic HTTP Authentication Interceptor for Apache CXF
import org.apache.cxf.binding.soap.interceptor.SoapHeaderInterceptor;
import org.apache.cxf.configuration.security.AuthorizationPolicy;
import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.message.Message;
import org.apache.cxf.transport.Conduit;
import org.apache.cxf.ws.addressing.EndpointReferenceType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@palesz
palesz / json_to_csv.html
Last active November 1, 2021 14:19
JSON to CSV converter
<html>
<head>
<style>
textarea {
height: 300px;
width: 100%;
}
</style>
<script type="text/javascript">
@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 (!)
@palesz
palesz / workflowy.user.js
Last active October 20, 2017 04:45
Workflowy Agenda (Greasemonkey user script)
// ==UserScript==
// @name workflowy
// @namespace http://palesz.org/
// @include https://workflowy.com/*
// @version 1
// @grant none
// ==/UserScript==
function escapeRegExp(str) {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
sudo add-apt-repository ppa:wine/wine-builds && sudo apt-get update && sudo apt-get install --install-recommends winehq-devel
@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
#!/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