Skip to content

Instantly share code, notes, and snippets.

View niradler's full-sized avatar
🎮

Nir Adler niradler

🎮
View GitHub Profile
@niradler
niradler / backup.js
Last active August 28, 2020 13:34
backup memex data using chrome snippet.
var dbName = 'memex';
var version = 1;
var conn = indexedDB.open(dbName, version) // change the name and version as needed
function exportToJson(idbDatabase) {
return new Promise((resolve, reject) => {
const exportObject = {}
if (idbDatabase.objectStoreNames.length === 0) {
resolve(JSON.stringify(exportObject))
substitutions:
devicename: ttgocam
friendly_name: test esp32cam
ip_address: 192.168.1.230
esphome:
name: $devicename
platform: ESP32
board: esp-wrover-kit
@niradler
niradler / Makefile
Created February 15, 2021 07:11
Makefile for go projects
GOCMD=go
GOTEST=$(GOCMD) test
GOVET=$(GOCMD) vet
BINARY_NAME=example
VERSION?=0.0.0
SERVICE_PORT?=3000
DOCKER_REGISTRY?= #if set it should finished by /
EXPORT_RESULT?=false # for CI please set EXPORT_RESULT to true
GREEN := $(shell tput -Txterm setaf 2)
@niradler
niradler / npm-install-all.sh
Created February 18, 2021 17:25
find and install npm packages in a mono repo.
npm i -g strin loop-pipe
find . -name package.json | grep -v node_modules | strin replace --t="package.json" --v="" --sr="ig" | lp "(cd {v} && npm i)"
@niradler
niradler / awsclidriver.py
Created July 26, 2021 16:20
python aws cli driver
import os
if os.environ.get('LC_CTYPE', '') == 'UTF-8':
os.environ['LC_CTYPE'] = 'en_US.UTF-8'
from awscli.clidriver import create_clidriver
driver = create_clidriver()
driver.main('s3 mv source_bucket target_bucket --recursive'.split())
# shellman options
# Usage: options=("one" "two" "three"); inputChoice "Choose:" 1 "${options[@]}"; choice=$?; echo "${options[$choice]}"
function inputChoice() {
echo "${1}"
shift
echo $(tput dim)-"Change option: [up/down], Select: [ENTER]" $(tput sgr0)
local selected="${1}"
shift
ESC=$(echo -e "\033")
@niradler
niradler / ssh_key.tf
Created August 31, 2021 14:46 — forked from irvingpop/ssh_key.tf
Terraform external data source example - dynamic SSH key generation
# ssh key generator data source expects the below 3 inputs, and produces 3 outputs for use:
# "${data.external.ssh_key_generator.result.public_key}" (contents)
# "${data.external.ssh_key_generator.result.private_key}" (contents)
# "${data.external.ssh_key_generator.result.private_key_file}" (path)
data "external" "ssh_key_generator" {
program = ["bash", "${path.root}/../ssh_key_generator.sh"]
query = {
customer_name = "${var.customer_name}"
customer_group = "${var.customer_group}"
@niradler
niradler / pi_setup.sh
Last active October 17, 2021 19:06
pi_setup.sh
sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y
sudo apt install shellinabox # https://ip:4200
sudo apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python
wget http://prdownloads.sourceforge.net/webadmin/webmin_1.920_all.deb
sudo dpkg --install webmin_1.920_all.deb # https://192.168.0.142:10000
Ping raspberrypi.local
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
sudo usermod -aG docker $(whoami)
apt-get -y install libffi-dev libssl-dev python3-dev python3 python3-pip
@niradler
niradler / addons.sh
Last active January 4, 2023 23:26
arm_setup.sh
chsh -s $(which zsh)
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
curl -sSL https://install.pi-hole.net | bash
curl -L https://install.pivpn.io | bash
@niradler
niradler / Selfhosted.md
Last active November 10, 2022 09:59
Self hosted

Self hosted

  • authelia
  • meshcentral
  • proxmox
  • tiny rss
  • appsmith
  • ghost/wordpress (cms/blog)
  • strapi/supabase/appwire/directus/pocketbase (headless cms/be)
  • nocodb