Skip to content

Instantly share code, notes, and snippets.

View interbiznw's full-sized avatar
🎯
Focusing

J62 interbiznw

🎯
Focusing
View GitHub Profile
@interbiznw
interbiznw / backup_digitalocean.md
Created March 2, 2022 11:52 — forked from amalmurali47/backup_digitalocean.md
Backup DigitalOcean droplet locally

DigitalOcean does not provide a way to download a snapshot of your droplet locally. You can use rsync to accomplish this instead.

On your local machine, assuming you have added your-server in your SSH config:

rsync -aAXHv --append-verify --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} your-server:/
  • -a : archive mode (all files, with permissions, etc.)
  • -A : preserve ACLs/permissions (not included with -a)
@interbiznw
interbiznw / pirmqtt_v2.py
Created August 1, 2021 05:02 — forked from bphermansson/pirmqtt_v2.py
Python script to send Mqtt message when Gpio on Raspberry Pi changes, for example triggered by a motion sensor
#!/usr/bin/python
# Read a Pir-sensor and send a Mqtt message when motion detected
# Uses edge detection to limit the rate of Mqtt-messages
import paho.mqtt.client as paho
import time
import urlparse
import RPi.GPIO as GPIO
import datetime
# Mqtt
@interbiznw
interbiznw / low-battery-level-detection-notification-for-all-battery-sensors.yaml
Last active June 24, 2021 11:32 — forked from sbyx/low-battery-level-detection-notification-for-all-battery-sensors.yaml
Home Assistant Blueprint: Low battery level detection & notification for all battery sensors
blueprint:
name: Low battery level detection & notification for all battery sensors
description: Regularly test all sensors with 'battery' device-class for crossing
a certain battery level threshold and if so execute an action.
domain: automation
input:
threshold:
name: Battery warning level threshold
description: Battery sensors below threshold are assumed to be low-battery (as
well as binary battery sensors with value 'on').
@interbiznw
interbiznw / Wanhao_Cura_Profile16.ini
Created June 12, 2021 12:09 — forked from joshgerdes/Wanhao_Cura_Profile16.ini
Monoprice Maker Select Plus (Wanhao i3 Plus) Setup
[profile]
layer_height = 0.16
wall_thickness = 1.2
retraction_enable = True
solid_layer_thickness = 1.2
fill_density = 10
nozzle_size = 0.4
print_speed = 50
print_temperature = 200
print_temperature2 = 0
@interbiznw
interbiznw / index.js
Created January 6, 2021 08:55 — forked from jkasun/index.js
Uploading Files to S3 With Node.js
const fs = require('fs');
const AWS = require('aws-sdk');
// Enter copied or downloaded access id and secret here
const ID = '';
const SECRET = '';
// Enter the name of the bucket that you have created here
const BUCKET_NAME = 'test-bucket-1242tsr';;
@interbiznw
interbiznw / facebook-page-invite.js
Last active March 24, 2020 00:33 — forked from guiliredu/facebook-page-invite.js
Facebook - Script to auto invite people who liked a page post do like the page
var buttons;
buttons = document.getElementsByClassName('pam');
for (var i = 0; i < buttons.length; i++) {
buttons[i].click();
}
var buttons;
buttons = document.getElementsByClassName('_42ft');
for (var i = 0; i < buttons.length; i++) {
if(buttons[i].getAttribute('ajaxify') != null){
@interbiznw
interbiznw / transfer.fish
Last active January 15, 2020 14:30 — forked from nl5887/transfer.fish
Bash and zsh alias for transfer.sh. Transfers files and directories to transfer.sh.
function transfer
if test (count $argv) -eq 0
echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"
return 1
end
## get temporarily filename, output is written to this file show progress can be showed
set tmpfile ( mktemp -t transferXXX )
## upload stdin or file
@interbiznw
interbiznw / login-notify.sh
Created January 9, 2020 08:41
/etc/ssh/login-notify.sh script,. place this line in /etc/pam.d/sshd: "session optional pam_exec.so seteuid /etc/ssh/login-notify.sh"
#!/bin/sh
# Change these two lines:
sender="root"
recepient="btcpj62"
if [ "$PAM_TYPE" != "close_session" ]; then
host="`hostname`"
subject="SSH Login: $PAM_USER from $PAM_RHOST on $host"
msg_content=\"$subject\"
@interbiznw
interbiznw / dns-ns-check.sh
Created December 28, 2019 10:25
DNS Propagation checker if !=
#!/usr/bin/env bash
# Purpose: DNS Propagation checker, Check and report if DNS NS are not equal to what they should be
# make sure DNS utilities are installed
if hash dig 2>/dev/null; then
echo "DNS utilities not installed"
exit
fi
# domain to check
@interbiznw
interbiznw / dns-ns-check.sh
Created December 28, 2019 10:23
DNS Propagation checker
#!/usr/bin/env bash
# Purpose: DNS Propagation checker
# Source: https://guides.wp-bullet.com
# make sure DNS utilities are installed
if hash dig 2>/dev/null; then
echo "DNS utilities not installed"
exit
fi