- reword:
git commit --amend
orgit commit --amend -m "New message"
- edit last commit:
git reset HEAD~
- make your changes
git add
your changesgit commit -c ORIG_HEAD
- git force-pull
- git prune-local
- git remove tags:
- remote:
git push --delete origin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare global { | |
type NonFalsy<T> = T extends false | 0 | "" | null | undefined | 0n ? never : T | |
interface Array<T> { | |
filter(predicate: BooleanConstructor, thisArg?: any): NonFalsy<T>[] | |
includes<S, R extends `${Extract<S, string>}`>( | |
this: ReadonlyArray<R>, | |
searchElement: S, | |
fromIndex?: number, | |
): searchElement is R & S |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function* mapWithLimitedConcurrency(arr, mapFn, limit = 8) { | |
for (let i = 0; i < arr.length; i += limit) { | |
yield await Promise.all(arr.slice(i, i + limit).map(mapFn)); | |
} | |
} | |
const items = [...] | |
const iterator = mapWithLimitedConcurrency(items, async x => ...); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
. "$(git --exec-path)/git-sh-setup" | |
USAGE="BRANCH" | |
_force_pull() { | |
if [ $# = 1 ]; then | |
git ls-remote -q --exit-code --heads origin $1 2>&1 1>/dev/null | |
if [ $? = 0 ]; then | |
git fetch origin $1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using.Manager { use => | |
val md = MessageDigest.getInstance("MD5") | |
val fis = use(Files.newInputStream(filePath)) | |
val dos = use(new DigestOutputStream(OutputStream.nullOutputStream(), md)) | |
fis.transferTo(dos) | |
BigInt(1, md.digest()).formatted(s"%0${md.getDigestLength * 2}x") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
. "$(git --exec-path)/git-sh-setup" | |
USAGE="" | |
_prune_local() { | |
if [ $# = 0 ]; then | |
# git 2.21+ | |
# -D is aggressive, beware | |
git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implicit class RichTry[T](val poorTry: Try[T]) extends AnyVal { | |
def getOrElseT[U >: T](default: Throwable => U): U = poorTry.fold(default, x => x) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object LookBehindIterator { | |
trait LookBehindIterator[+A] extends Iterator[A] { | |
def last: A | |
def lastOption: Option[A] = Option(last) | |
} | |
implicit class ImplicitLookBehindIterator[T](val it: Iterator[T]) extends AnyVal { | |
def lookBehind: LookBehindIterator[T] = | |
new scala.collection.AbstractIterator[T] with LookBehindIterator[T] { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
if [ -z ${DATABASE_HOST+x} ] | |
then | |
echo "$0: Provide DATABASE_HOST environment variable" >&2 | |
exit 1 | |
fi | |
attempt=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return new Promise( | |
(resolve, reject) => { | |
const waitForParams = { | |
tasks: [taskArn], | |
cluster: ecs_cluster, | |
} | |
//provisioning takes time as well | |
ecs.waitFor('tasksRunning', waitForParams, (err, data) => { | |
if (err) { | |
ecs.describeTasks(waitForParams, (errDt, data) => { |
NewerOlder