Skip to content

Instantly share code, notes, and snippets.

@nfekete
nfekete / check_if_array_is_empty.zsh
Created September 15, 2023 22:38 — forked from fhuitelec/check_if_array_is_empty.zsh
[Check if array is empty] #zsh #shell #cheatsheet
#!/usr/bin/env zsh
#
# Check if array is empty
#
typeset -A knock_sequences
if [ ${#knock_sequences[@]} -eq 0 ]; then
echo "No knock sequence found."
@nfekete
nfekete / path component extraction.sh
Last active April 10, 2023 00:04 — forked from zfenj/gist:43dc107ab0685343d558d2c8024081fd
Zsh: Get Filename or Extension from Path
# https://zaiste.net/zsh_get_filename_extension_path/#!/bin/zsh
# Filename
fullpath="/etc/nginx/nginx.conf"
filename=$fullpath:t
echo $filename
# result: nginx.conf
# Path
fullpath="/etc/nginx/nginx.conf"
{
"Key Mappings": {
"0x2a-0x200000": {
"Action": 12,
"Text": "*"
},
"0x2b-0x200000": {
"Action": 12,
"Text": "+"
},
@nfekete
nfekete / remove-fb-tracking.user.js
Created March 2, 2021 20:18 — forked from k-barton/remove-fb-tracking.user.js
Greasemonkey user script: Remove Facebook's external link tracking
// ==UserScript==
// @name Remove Facebook's external link tracking (updated for the new FB)
// @description Removes redirection and "FB click identifier" from external FB links
// @namespace https://gist.github.com/k-barton
// @include https://*.facebook.com*
// @include http://*.facebook.com*
// @version 0.3.2
// @grant unsafeWindow
// @run-at document-start
// ==/UserScript==
@nfekete
nfekete / dns-sync.sh
Created August 8, 2018 03:49 — forked from matthiassb/dns-sync.sh
Init.d script for keeping WSL resolv.conf in-sync with Windows
#! /bin/bash
### BEGIN INIT INFO
# Provides: dns-sync
# Required-Start:
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Synchronizes /etc/resolv.conf in WLS with Windows DNS - Matthias Brooks
### END INIT INFO
@nfekete
nfekete / GeoJson.java
Created May 22, 2018 13:33 — forked from ibaca/GeoJson.java
GWT JsInterop DTOs inheritance
import static com.fasterxml.jackson.annotation.JsonTypeInfo.As.EXISTING_PROPERTY;
import static com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME;
import static jsinterop.annotations.JsPackage.GLOBAL;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nullable;
import jsinterop.annotations.JsOverlay;
@nfekete
nfekete / git-rename-branch.sh
Last active December 14, 2016 01:09 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote