Skip to content

Instantly share code, notes, and snippets.

Avatar

Aakarshit Uppal aksh1618

View GitHub Profile
@elizarov
elizarov / DeepRecursiveFunction.kt
Last active Jul 13, 2021
Defines recursive function that keeps its stack on the heap (productized version)
View DeepRecursiveFunction.kt
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
/**
* Defines deep recursive function that keeps its stack on the heap,
* which allows very deep recursive computations that do not use the actual call stack.
* To initiate a call to this deep recursive function use its [invoke] function.
* As a rule of thumb, it should be used if recursion goes deeper than a thousand calls.
*
* The [DeepRecursiveFunction] takes one parameter of type [T] and returns a result of type [R].
View scrcpy_shortcut.md

Scrcpy Shortcuts

Action Shortcut
switch fullscreen mode Ctrl+f
resize window to 1:1 (pixel-perfect) Ctrl+g
resize window to remove black borders Ctrl+x | Double-click¹
click on HOME Ctrl+h | Middle-click
click on BACK Ctrl+b | Right-click²
click on APP_SWITCH Ctrl+m
View explain-shell.sh
#!/bin/bash
set -euo pipefail
# Here strings are noted to be faster for a small amount of
# data as compared to pipes where the setup cost dominates.
# https://unix.stackexchange.com/a/219806/158139
response=$(w3m -dump "http://explainshell.com/explain?cmd="$(echo $@ | tr ' ' '+'}))
cat -s <(grep -v -e explainshell -e • -e □ -e "source manpages" <<< "$response")
@dmurawsky
dmurawsky / index.js
Last active Nov 17, 2022
How to make a page full height in Next.js
View index.js
const FullHeightPage = () => (
<div>
Hello World!
<style global jsx>{`
html,
body,
body > div:first-child,
div#__next,
div#__next > div {
height: 100%;
@lopspower
lopspower / README.md
Last active Nov 28, 2022
Hexadecimal color code for transparency
View README.md

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@ctechols
ctechols / compinit.zsh
Last active Oct 2, 2022
Speed up zsh compinit by only checking cache once a day.
View compinit.zsh
# On slow systems, checking the cached .zcompdump file to see if it must be
# regenerated adds a noticable delay to zsh startup. This little hack restricts
# it to once a day. It should be pasted into your own completion file.
#
# The globbing is a little complicated here:
# - '#q' is an explicit glob qualifier that makes globbing work within zsh's [[ ]] construct.
# - 'N' makes the glob pattern evaluate to nothing when it doesn't match (rather than throw a globbing error)
# - '.' matches "regular files"
# - 'mh+24' matches files (or directories or whatever) that are older than 24 hours.
autoload -Uz compinit
@oshybystyi
oshybystyi / git-auto-status.plugin.zsh
Created Jun 10, 2015
OhMyZsh plugin to display git status after a bunch of predefined git commands
View git-auto-status.plugin.zsh
#
# Run git status after specified set of command
#
# @author Oleksandr Shybystyi oleksandr.shybystyi@gmail.com
#
# default list of git commands `git status` is running after
gitPreAutoStatusCommands=(
'add'
'rm'
@miguelfrde
miguelfrde / archinstall.md
Last active Aug 29, 2022
Preinstalled Windows 8.1 and Arch Linux dual boot
View archinstall.md

Arch Linux installation (preinstalled Windows 8.1 dual boot)

Before

  1. Disable Windows Fast-Startup
  2. Disable Secure Boot

Partitioning

@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active Nov 23, 2022
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.
View gitflow-breakdown.md

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository