Skip to content

Instantly share code, notes, and snippets.

View OndraZizka's full-sized avatar
🍊

Ondrej Zizka OndraZizka

🍊
View GitHub Profile
@OndraZizka
OndraZizka / switchHeadphones.sh
Last active March 25, 2024 12:58
Bluetooth headset - switch between quality sound + no mic (A2DP) and crappy sound and mic (HSP/HFP)
#!/bin/bash
#### Restart Bluetooth
if [ "$1" == "resetBT" ] ; then
sudo rfkill block bluetooth && sleep 0.1 && sudo rfkill unblock bluetooth;
exit;
fi;
#### Toggle listen/speak
if [ "$1" == "" -o "$1" == "toggle" ] ; then
@OndraZizka
OndraZizka / CITC-CI-MavenManagedVersisons.seq.txt
Last active February 24, 2018 00:27
CITC CICD for sequencediagram.org
title Collab CI pipeline
space
==Commit verification job - project integration tests \n\nAlternative 2 - version metadata resolved by leveraging Maven.== #gold
entryspacing 0.4
#actor Space for widening the source box...............................
actor Commiter
participant "Stash\n" as Stash #DodgerBlue
@OndraZizka
OndraZizka / repull.sh
Last active November 29, 2017 17:25
Git + Maven fetch, clean, pull, build, rebase, build and push script.
#!/bin/bash
REBASE_ONTO_BRANCH="develop"
REBASE_ONTO_REMOTE="upstream"
STARTING_COMMIT=$(git rev-parse HEAD)
STARTING_BRANCH=(git rev-parse --abbrev-ref HEAD)
GO_INTO_CONFLICT="";
if [ "$1" == "force" ] ; then
GO_INTO_CONFLICT="true";
@OndraZizka
OndraZizka / .bash_profile
Last active November 19, 2017 02:25
Correct Bash prompt line with a time, current path, error code and $.
function nonzero_return() {
RETVAL=$?
[ $RETVAL -ne 0 ] && echo "$RETVAL"
}
## Non-bold
#export PS1="\[\e[33m\]\A\[\e[m\] \[\e[32m\]\w\[\e[m\] \`nonzero_return\`\[\e[35m\]\\$\[\e[m\] "
## Bold
export PS1="\[\e[01;33m\]\A\[\e[m\] \[\e[01;32m\]\w\[\e[m\] \`nonzero_return\`\[\e[01;35m\]\\$\[\e[m\] "
@OndraZizka
OndraZizka / JerseyResourcesListingResource.java
Created November 15, 2017 22:41
Listing REST endpoints / resources with Jersey IntrospectionModeller
@Path("/")
public class ResourceListingResource
{
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response showAll( @Context Application application,
@Context HttpServletRequest request)
{
String basePath = request.getRequestURL().toString();
@OndraZizka
OndraZizka / DefaultKeyBinding.Dict
Created November 6, 2017 13:53
Mac OS 10.x Windows/Linux-like key bindings - Home, End, etc.
/* Just Home and End
{
"\UF729" = moveToBeginningOfLine:; // home
"\UF72B" = moveToEndOfLine:; // end
"$\UF729" = moveToBeginningOfLineAndModifySelection:; // shift-home
"$\UF72B" = moveToEndOfLineAndModifySelection:; // shift-end
}
*/
@OndraZizka
OndraZizka / git-sync.sh
Created March 20, 2017 16:28
Svn to Git conversion Bash script
set -e
TMP_DIR=`pwd`/tmp-data
TMP_REPO=`pwd`/jawabot
mkdir -p $TMP_DIR;
if [ ! -d $TMP_REPO ] ; then
mkdir -p $TMP_REPO;
cd $TMP_REPO;
git init;
@OndraZizka
OndraZizka / git-aliases.txt
Created January 9, 2017 07:51
Git goodies
alias.co checkout
alias.ci commit
alias.st status
alias.br branch
alias.hist log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
alias.lg log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
alias.type cat-file -t
## Checks the trailing whitespace and a \n before EOF
@OndraZizka
OndraZizka / ide.sh
Last active July 29, 2017 00:40
IDE file open script
#!/bin/bash
##
## Run `ide.sh FooBar` and it most likely opens what you are looking for in the IDE:
##
## 1) Tries to open the path.
## 2) If it doesn't exist, it tries to open that file anywhere in the directory tree (provided it has some of the file name suffixes I currently use).
## 3) If not exists, it opens the files that contains a type of that name (class, function, interface).
## 4) If not found, it opens the files that contain given pattern.
##
@OndraZizka
OndraZizka / Cache.ts
Last active December 18, 2016 17:17
TypeScript util classes
/**
* Caches results returned from given fetcher callback for given key,
* up to maxItems results, deletes the oldest results when full (FIFO).
*/
export class StaticCache
{
static cachedData: Map<string, any> = new Map<string, any>();
static maxItems: number = 400;
static get(key: string){