Skip to content

Instantly share code, notes, and snippets.

@Neoklosch
Neoklosch / keybinder.py
Created July 15, 2015 15:31
Basic implementation of keybinding with python xlib
from Xlib.display import Display
from Xlib import X
class KeyBinder(object):
def __init__(self):
self.cancel = False
self.xdisp = Display()
self.xroot = self.xdisp.screen().root
self.key_code = 71 # F5
ffmpeg -re \
-i <filename>.mp4 \
-pix_fmt yuvj420p \
-x264-params keyint=48:min-keyint=48:scenecut=-1 \
-b:v 4500k \
-b:a 128k \
-ar 44100 \
-acodec aac \
-vcodec libx264 \
-preset medium \
@Neoklosch
Neoklosch / .bash_alias
Created October 23, 2021 19:37
Mac Bash alias
# ls aliases
alias l='ls --color'
alias ll='ls -la'
alias lt='l -rt'
alias la='l -A'
alias llt='l -lrt'
alias lla='l -lA'
alias llat='l -lArt'
# helpful aliases
@Neoklosch
Neoklosch / rename.sh
Created September 16, 2021 13:08
rename all png files
COUNTER=1
for file in *.png; do
mv "$file" "$COUNTER.png"
COUNTER=$[$COUNTER +1]
done
@Neoklosch
Neoklosch / convert.sh
Last active January 15, 2020 15:34
Convert image with color from first pixel with imagemagick
#/bin/bash
# Unzip all zip files
for f in *.zip; do unzip "$f" -d "${f%.*}"; done
# Move all jpgs to displate
find . \( -iname "*.jpg" ! -iname "*_hoodie.jpg" \) -mindepth 2 -type f -print -exec mv -f {} ../displate/ \;
cd ../displate
@Neoklosch
Neoklosch / .gitconfig
Last active November 29, 2019 14:44
git aliases
[alias]
hide = update-index
show = update-index
purge = remote prune origin
purge-dry = remote prune origin --dry-run
l = log --graph --oneline --all --decorate --topo-order
last = rebase -i HEAD~1
l2 = log --graph --abbrev-commit --decorate --format=format:"%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)" --all
l3 = log --graph --abbrev-commit --decorate --format=format:"%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n"" %C(white)%s%C(reset) %C(dim white)- %an%C(reset)" --all
@Neoklosch
Neoklosch / vexels.js
Last active November 17, 2019 07:28
Vexels script
main.js
function setupGetInfo(tabId) {
const code = `(function getInfo() {
var title = document.getElementById('vector_title').innerText.toLowerCase()
.replace(" t-shirt design", "")
.replace(" tshirt design", "")
.replace("t-shirt design", "")
.replace("tshirt design", "")
.trim();
title = title[0].toUpperCase() + title.slice(1);
@Neoklosch
Neoklosch / .bash_aliases
Last active January 17, 2019 17:32
Bash Aliases
# adb aliases
alias adb='/opt/android-sdk/platform-tools/./adb'
alias adb-start='adb start-server'
alias adb-stop='adb kill-server'
alias adb-restart='adb kill-server start-server'
adbfind() {
package=$(adb -d shell pm list packages | grep -wE "$1($|\s)" | sed "s/package://g");
pathtopackage=$(adb -d shell pm path $package | sed "s/package://g");
echo $pathtopackage;
@Neoklosch
Neoklosch / README.md
Created February 14, 2018 10:50 — forked from lopspower/README.md
How to Analyze & Manage Memory on Android Like a Boss

Analyze & Manage Memory on Android Like a Boss

This Blog is all about memory management in Android. It provides information about how you can analyze & reduce memory usage while developing an Android app.

Memory management is a complex field of computer science and there are many techniques being developed to make it more efficient. This guide is designed to introduce you to some of the basic memory management issues that programmers face.

Memory Management in Android

Android is a Linux based operating system. It uses native open source C libraries which power Linux machines. All the basic operating system operations like I/O, memory management and so on are handled by the Linux kernel. Like Java and .NET, Android uses its own run time and virtual machine to manage application memory. Unlike either of these frameworks, the Android run time also manages the lifetime processes. Each Android application runs in a separate process within its own Dalvik instance, relinquishing all responsibility for memo

#!/bin/bash
CMD="./gradlew clean test"
# Check if we actually have commits to push
commits=`git log @{u}..`
if [ -z "$commits" ]; then
exit 0
fi
$CMD