Skip to content

Instantly share code, notes, and snippets.

@grational
grational / vim-recover.sh
Created March 2, 2020 09:37
vim-recover: recover all the vim orphan swap files
#!/usr/bin/env bash
# vim-recover: recover all the orphan swap files
# @version: 0.5b
# @require: set directory=~/.config/nvim/swap_files//
# @author: Giuseppe Ricupero
# @e-mail: [email protected]
set -euo pipefail
IFS=$'\n\t'
vim_flavour=/usr/bin/vim
@sharunkumar
sharunkumar / adbdns.bat
Created February 7, 2020 07:39
Windows batch file to toggle private dns setting in android via adb
@echo off
setlocal ENABLEDELAYEDEXPANSION
for /F %%i in ('adb shell settings get global private_dns_mode') do set dnsmode=%%i
for /F %%i in ('adb shell settings get global private_dns_specifier') do set dnshost=%%i
echo current dns setting is: !dnsmode!
if "!dnsmode!"=="hostname" (
echo current dns host is: !dnshost!
echo turning off private dns...
adb shell settings put global private_dns_mode off
@sharunkumar
sharunkumar / adb-dns.bat
Created February 7, 2020 07:08
Enabling / Disabling private DNS in android via ADB
rem to disable private dns
adb shell settings put global private_dns_mode off
rem to enable private dns with hostname (example with dns.adguard.com)
adb shell settings put global private_dns_mode hostname
adb shell settings put global private_dns_specifier dns.adguard.com
@msramalho
msramalho / Cryptography.java
Created January 13, 2020 22:59
Java Class to manage cryptography keys in Android Keystore using "AES/CBC/PKCS7Padding" - encrypt and decrypt strings
import android.security.keystore.KeyGenParameterSpec;
import android.security.keystore.KeyProperties;
import android.util.Base64;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.KeyStore;
import java.security.KeyStoreException;
@emolitor
emolitor / alpine-chroot.sh
Last active August 25, 2023 23:28
chroot script for testing aarch64
# This simple script is setting up a Alpine Linux installation in a chroot.
# chroot will be placed in the current working directory.
#
# Most parts of this script are written down at
# http://wiki.alpinelinux.org/wiki/Setting_up_the_build_environment_in_chroot
#
# Licensed under GPLv2
#
# Copyright (c) 2011-2019 Fabian Affolter <fabian at affolter-engineering.ch>
@atx
atx / __README.md
Last active August 29, 2023 22:17
My grafana dashboard for prometheus-tor_exporter

Don't forget to modify the __inputs key to match your data source setup. You should also replace the string your.instance.here with the instance name associated with your metrics.

#!/bin/bash
###
# Requires Null Keyboard https://play.google.com/store/apps/details?id=com.wparam.nullkeyboard
# Author: Volodymyr Shymanskyy
###
brightness=$(adb shell settings get system screen_brightness)
ime=$(adb shell settings get secure default_input_method)
@mohakshah
mohakshah / Instructions.md
Last active July 15, 2023 04:58
Building ZFS on Raspberry Pi 3 running Rasbpian

Introduction

This is a tutorial for building and installing the latest release version (0.7.3 as of writing) of "ZFS on Linux" on a Raspberry Pi 3 running Raspbian Stretch. Specifically, we'll be building the dkms version of ZoL, which saves you the hassle of re-compiling the kernel modules after every kernel update. Even though ZoL added support for building dkms packages for debian in version 0.7.3, the build process on a Raspberry Pi 3 is not quite straight-forward. Hopefully, these instructions will make it easier.

Steps

  1. Install the build dependencies.
$ sudo apt-get update
$ sudo apt-get install build-essential autoconf libtool gawk alien fakeroot
$ sudo apt-get install dkms zlib1g-dev uuid-dev libattr1-dev libblkid-dev libselinux-dev libudev-dev libssl-dev parted lsscsi wget ksh
@johnstanfield
johnstanfield / agent.conf
Last active August 1, 2023 03:33
Configuration to make OSSEC HIDS watch fail2ban.log and alert on fail2ban actions
<!-- add this to /var/ossec/etc/shared/agent.conf -->
<localfile>
<log_format>syslog</log_format>
<location>/var/log/fail2ban.log</location>
</localfile>