Skip to content

Instantly share code, notes, and snippets.

View peterroth's full-sized avatar
:octocat:
🐛 generating bugs

Péter Róth peterroth

:octocat:
🐛 generating bugs
View GitHub Profile
@peterroth
peterroth / snap.sh
Created June 18, 2024 07:46
Remove unused snaps on Ubuntu
#!/bin/sh
set -eu
LANG=C
snap list --all | awk '/disabled/{print $1, $3}' |
while read snapname revision; do
snap remove "$snapname" --revision="$revision"
done
@peterroth
peterroth / local-remote-in-terminal-header.txt
Last active July 21, 2023 14:43
How to modify .bashrc to show "localhost" if we are working on the local machine and show the remote machine's name if we are logged in on a remote one in the terminal's header
case "$TERM" in
xterm*|rxvt*)
if [ $(hostname) == proth-laptop ]; then
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}localhost: \w\a\]$PS1"
else
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
fi
;;
*)
;;
@peterroth
peterroth / kubectl-context-git-branch-in-prompt.txt
Last active September 8, 2023 17:48
what to add in .bashrc to show kubectl's current context and active git branch in shell
# Add funciton to check which context is active for kubectl
function kube_context {
CONTEXT=$(grep "current-context:" ~/.kube/config | sed "s/current-context: //")
if [ -n "$CONTEXT" ]; then
if [ "${CONTEXT}" = "\"\"" ]; then
CONTEXT=""
fi
case $CONTEXT in
*api-okd-prodcluster-com:6443*) export CONTEXT=`echo ${CONTEXT} | sed 's/\/api-okd-prodcluster-com:6443/PROD-cluster/'`;;
*api-okd-testcluster-com:6443*) export CONTEXT=`echo ${CONTEXT} | sed 's/\/api-okd-testcluster-com:6443/TEST-cluster/'`;;
@peterroth
peterroth / protobuf-250-on-mac.txt
Created February 18, 2021 10:01
How to install protobuf 2.5.0 on Mac (10.15.7, Catalina). brew required!
brew install automake libtool wget
wget https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.bz2
tar -xvjf protobuf-2.5.0.tar.bz2
cd protobuf-2.5.0
./autogen.sh
./configure
make; make check
sudo make install
Validate the successful installation:
@peterroth
peterroth / oneplus-debloat.md
Last active June 10, 2024 02:49
Packages I deleted from my OnePlus device. I know there are a lot of tools and programs to debloat, but I feel better when I know what I deleted

Google stuff:

com.android.chrome
com.google.android.music
com.google.android.videos
com.google.android.apps.tachyon

Qualcomm's User Identiy Module:

com.qualcomm.uimremoteclient
com.qualcomm.uimremoteserver

@peterroth
peterroth / bash_profile_for_git.md
Created September 21, 2020 21:17
Bash profile to show git branch in the prompt in a git directory
function parse_git_branch {
   git branch --show-current --no-color 2> /dev/null | sed 's/^/ /'
}

export PS1="\[\033[01;32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\]: "
export CLICOLOR=1
Protocol Buffers 2.5.0 is no longer available in Homebrew, it must he downloaded from source, compiled and installed:
$ wget https://github.com/protocolbuffers/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz
$ tar zxvf protobuf-2.5.0.tar.gz
$ cd protobuf-2.5.0
$ ./configure
$ make
$ make check
$ make install
$ protoc --version

Signing commits on GitHub

Creating the PGP key

Create key. There are plenty of how-tos on internet
gpg --list-secret-keys --keyid-format LONG
gpg --armor --export <ID>
Add on github.com

Configure the client on the machine:

git config --global commit.gpgsign true

IMPORTANT DISCLAIMER: Many of the found "properties" aren't really useful or mistakenly listed,
like those starting with "org.apache.hadoop.*". The tool simply greps a pattern in the matching
files, and some of them are not used as properties. On the other hand, all named properties from
the given configuration file are removed, so quite a few are valid. Again, some of those are still
hidden on purpose, since it is not useful to tinker with them unless in extreme situations, or
during test runs. Be VERY CAREFUL of what you do. I warned ya!
$ sh target/bin/run-finder -d /projects/opensource/hbase/hbase-trunk-rw-git/ -u -s \
--exclude **/generated --exclude **/generated/** --exclude **/target \
--exclude **/test/** -c hbase-common/src/main/resources/hbase-default.xml -o /dev/null
@peterroth
peterroth / AndroidDoze_flowchart
Last active November 22, 2019 13:11
The flowchart of Android Doze; original work is done by Arstoien on XDA Forum: https://forum.xda-developers.com/showpost.php?p=63694133&postcount=532 Chart drawn on http://asciiflow.com/ Def = default value
motion_inactive_to +---------------------+ +------------------------------+ motion_inactive_to
Def: 600 +-------+ While sensing_to: <------+ While idle_after_inactive_to:<---------+ Def:600
| | AnyMotion reported? | | AnyMotion reported? | |
| +---------------------+ +------------------------------+ |
| motion_inactive_to +-------+------------+
| sensing_to Def: 600 | While idle_to: |
+-v-------+ Def: 240 | AnyMotion