Skip to content

Instantly share code, notes, and snippets.

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}
@soberich
soberich / Ballot.sol
Last active October 30, 2022 16:09
Ballot
pragma solidity ^0.4.17;
contract Ballot {
struct Voter {
uint weight;
bool voted;
uint8 vote;
// address delegate;
}
@soberich
soberich / AdbCommands
Created February 1, 2021 19:07 — forked from goofwear/AdbCommands
Adb useful commands list
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
@soberich
soberich / Search Wikipedia.POWERPOINT.yaml
Created January 23, 2021 02:39
Searches Wikipedia based on the selected text in the presentation.
name: Search Wikipedia
description: Searches Wikipedia based on the selected text in the presentation.
host: POWERPOINT
api_set: {}
script:
content: |
/*
* Copyright (c) Riwut Libinuko. All rights reserved. Licensed under the MIT license.
*/
@soberich
soberich / enumset
Created September 6, 2020 22:18 — forked from SergejIsbrecht/enumset
EnumSet
sergej@sergej-P50:~/Development/IdeaProjects/playground$ /home/sergej/.sdkman/candidates/java/13.0.1.hs-adpt/bin/java -version
openjdk version "13.0.1" 2019-10-15
OpenJDK Runtime Environment AdoptOpenJDK (build 13.0.1+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 13.0.1+9, mixed mode, sharing)
sergej@sergej-P50:~/Development/IdeaProjects/playground$ uname -a
Linux sergej-P50 4.18.0-25-generic #26-Ubuntu SMP Mon Jun 24 09:32:08 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
jol >> java.util.RegularEnumSet, size=1584
jol >> org.eclipse.collections.impl.set.mutable.UnifiedSet, size=976
@soberich
soberich / .antigenrc
Created May 16, 2020 02:40
.antigenrc
# Load oh-my-zsh library.
antigen use oh-my-zsh
if [[ $OSTYPE == darwin* ]]; then
antigen bundle osx
fi
# Load bundles from the default repo (oh-my-zsh).
antigen bundle git
antigen bundle git-extras
@soberich
soberich / ZipUtils.java
Last active January 26, 2025 12:47
Java 7 NIO2 Download ZIP from URL and Unzip on the fly with Channels (WITHOUT CREATING INTIMIDATE COPY OF DATA BYTES)
package com.example;
import java.io.IOException;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.zip.ZipEntry;
@soberich
soberich / bulk_clone_bitbucket.sh
Created April 30, 2020 18:54
Bulk clone repos in Bitbucket REST Api 2.0
# prerequisites: `httpie`, `jq`, GNU's `parallel`. e.g. brew install <package>
# there is max 100 page length n pages where n is 100 length page. Execute one one by one (there is no way you'll get more than 100 times parallelization)
# in `.values[].links.clone[1].href` `1` is for SSH, where `0` would be for HTTPS.
http https://<user>:<pass>@api.bitbucket.org/2.0/repositories/<account_name> pagelen==100 page==<page_num> | jq -r '.values[].links.clone[1].href' | parallel git clone
# Voila it takes approx 1-2 minutes to clone a 100 repos.