Skip to content

Instantly share code, notes, and snippets.

View brunogama's full-sized avatar

Bruno da Gama Porciuncula brunogama

View GitHub Profile
// FROM SWIFTLINT
import Dispatch
import Foundation
private let outputQueue: DispatchQueue = {
let queue = DispatchQueue(
label: "io.realm.swiftlint.outputQueue",
qos: .userInteractive,
target: .global(qos: .userInteractive)
)
@brunogama
brunogama / box.swift
Created December 4, 2024 10:06
Conformed Box
final class Box<Type> {
var value: Type
init(_ value: Type) {
self.value = value
}
}
extension Box: CustomStringConvertible where Type: CustomStringConvertible {
var description: String {
@brunogama
brunogama / nuke-xcinstall.sh
Last active January 17, 2023 13:56
XCInstall cleaner
#!/bin/bash
FIRST_APP_ON_XC_INSTALL=$(find ~/Library/Developer/Xcode/DerivedData \
-path "*/Build/Products/*/.XCInstall/*.app" \
-type d \
-maxdepth 6 \
-print \
-quit \
-exec dirname {} \;)
CLEAN=${FIRST_APP_ON_XC_INSTALL%/*}
@brunogama
brunogama / .gitconfig
Created November 23, 2022 10:17 — forked from codexico/.gitconfig
git alias
# https://gist.github.com/codexico/2a34c0d599f3af93b46f
[color]
# Use colors in Git commands that are capable of colored output when
# outputting to the terminal. (This is the default setting in Git ≥ 1.8.4.)
ui = auto
[color "branch"]
pihole -w clients4.google.com
pihole -w clients2.google.com
pihole -w s.youtube.com
pihole -w video-stats.l.google.com
pihole -w www.googleapis.com
pihole -w youtubei.googleapis.com
pihole -w oauthaccountmanager.googleapis.com
pihole -w android.clients.google.com
pihole -w reminders-pa.googleapis.com firestore.googleapis.com
pihole -w gstaticadssl.l.google.com
@brunogama
brunogama / functions.sh
Created December 8, 2021 00:21 — forked from junegunn/functions.sh
Key bindings for git with fzf (https://junegunn.kr/2016/07/fzf-git/)
# GIT heart FZF
# -------------
is_in_git_repo() {
git rev-parse HEAD > /dev/null 2>&1
}
fzf-down() {
fzf --height 50% --min-height 20 --border --bind ctrl-/:toggle-preview "$@"
}
Setup a Static IP Address
Questions about setting Static IP Address are among the most common on this site. There are very many tutorials (many wrong, obsolete or incomplete).
If the reason you are contemplating a Static IP Address is you want your Pi to be assigned a predictable IP Address you can request the DHCP server to assign one.
E.g. Adding the following to /etc/dhcpcd.conf will request an address on wlan0 and on eth0.
interface wlan0
request 10.1.2.99
interface eth0
@brunogama
brunogama / clear-carthage.sh
Last active March 24, 2021 13:02
Clears carthage http cache
sqlite3 ~/Library/Caches/carthage/Cache.db 'DELETE from cfurl_cache_response where request_key like "%.json"'
@brunogama
brunogama / process.sh
Created January 21, 2021 19:44 — forked from krzysztofzablocki/process.sh
3rd party tooling processing script
#!/bin/zsh
cd "$(dirname "$0")/.."
if [[ -n "$CI" ]] || [[ $1 == "--fail-on-errors" ]] ; then
FAIL_ON_ERRORS=true
echo "Running in --fail-on-errors mode"
ERROR_START=""
COLOR_END=""
INFO_START=""
@brunogama
brunogama / .gitconfig
Created January 14, 2021 17:38 — forked from gonchar/.gitconfig
git aliases
[alias]
# full status
rstatus = !sh -c 'git status -sb --ignore-submodules=dirty && git submodule foreach --recursive git status -sb --ignore-submodules=dirty' -
rstatus-no-subs = !sh -c 'git status -sb --ignore-submodules=all && git submodule foreach --recursive git status -sb --ignore-submodules=all' -
s = !sh -c 'git rstatus-no-subs' -
# fetches all modules
rfetch = !sh -c 'git fetch && git submodule foreach --recursive git fetch' -
# updates project and all submodules
r-fetch-pull-merge = !sh -c 'git rfetch && git submodule foreach --recursive git merge && git merge && git s' -
r-fetch-pull-rebase = !sh -c 'git rfetch && git submodule foreach --recursive git rebase && git rebase && git s' -