Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View inthuriel's full-sized avatar

Mikołaj Niedbała inthuriel

View GitHub Profile
#!/usr/bin/env bash
# This script get all logs from all containers in the namespace
# Usage
# ./all-logs.sh -n [namespace] -s [hours]
# parse args
while getopts ":n:s:" opt; do
case $opt in
n) namespace="$OPTARG"
#!/usr/bin/env bash
##
# Simle script to update domain resolve in OC masters
##
set -eu
AWS_PROFILE=""
HOSTED_ZONE_ID=""
DOMAIN=""
#include <Adafruit_NeoPixel.h>
// necessary constants
const unsigned int ambient_diode_pin = A1, // input pin for ambient light phototransistor
set_moisturize_level_input_pin = A2, // input pin for DIP switch to set level of moisturize start
set_moisturize_duration_input_pin = A3, // input pin for DIP switch to set moisturize duration time
night_only_pin = 3, // input pin for DIP switch to set if we want to check if it's dark
moisture_sensor_pin = A0, // input pin for moisture sensor
motor_enable_pin = 10, // output pin to set motor speed
motor_pin1 = 9, // output pin for motor connector 1
// required liblaries
#include <LiquidCrystal_I2C.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <Adafruit_BME280.h>
#include <RTClib.h>
#include <uptime_formatter.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <Timezone.h>
@inthuriel
inthuriel / weather-api-integration.py
Created May 29, 2022 13:37
Sample integration with weather API
from datetime import datetime
import requests
from requests.exceptions import HTTPError
WEATHER_API_URL="http://<api-url>"
WEATHER_API_ENDPOINT = "/api/v1/sensor"
def run() -> None:
api = f"{WEATHER_API_URL}{WEATHER_API_ENDPOINT}"
try:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.yubikey.app</string>
<key>Program</key>
<string>/Users/[user]/.yubico/yubikey-daemon.sh</string>
<key>KeepAlive</key>
<true/>
#!/bin/bash
LAST_STATE=`system_profiler SPUSBDataType | grep -ci yubikey | cat`
while :
do
CURRENT_STATE=`system_profiler SPUSBDataType | grep -ci yubikey | cat`
if [ $LAST_STATE -eq $CURRENT_STATE ]; then
# do nothing
true
elif [ $LAST_STATE -lt $CURRENT_STATE ]; then
#echo "Key inserted"
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
# encoding=utf8
import re
import pprint
import json
import requests
import base64
import sys
@inthuriel
inthuriel / freemem.sh
Last active April 24, 2018 10:23
Bash script to clean system caches in Linux OS
#!/bin/sh
###########################################################################
# use freemem [lvl] [limit to run /num//unit/] [limit to 0- total 1- cache] #
# example usage ./freemem 3 3G 0 #
# author Mikolaj 'Metatron' Niedbala #
# licenced GNU/ GPL #
###########################################################################
echo $1 $2 $3
if [ "$1" -gt "3" ]; then
echo "Cache cleaning level out of range"