Skip to content

Instantly share code, notes, and snippets.

View gdarko's full-sized avatar
Crunching code, one line at a time.

Darko Gjorgjijoski gdarko

Crunching code, one line at a time.
  • Self-employed
  • The Internet
  • 17:41 (UTC +01:00)
View GitHub Profile
@gdarko
gdarko / motion_switch_light.yaml
Last active September 24, 2023 20:53 — forked from Ultra9k/motion_switch_light.yaml
This is a blueprint based on the original motion_light from Home Assistant. This one, however, allows you to control not only lights but also switches when motion is detected.
blueprint:
name: Motion-activated Switch and/or Light
description: Turn on a switch and/or light when motion is detected.
domain: automation
source_url: https://darkog.com/blog/home-assistant-motion-lights-with-switches/
input:
motion_entity:
name: Motion Sensor
selector:
entity:
@gdarko
gdarko / cloudflare-update-record.sh
Last active March 2, 2018 00:20 — forked from benkulbertis/cloudflare-update-record.sh
Cloudflare API v4 Dynamic DNS Update in Bash
#!/bin/bash
# CHANGE THESE
auth_email="[email protected]"
auth_key="c2547eb745079dac9320b638f5e225cf483cc5cfdda41" # found in cloudflare account settings
zone_name="$1"
record_name="$2"
# MAYBE CHANGE THESE
ip=$(curl -s http://ipv4.icanhazip.com)
@gdarko
gdarko / create_user.sh
Created October 28, 2017 16:22 — forked from divyavanmahajan/create_user.sh
Turnkey OpenVPN - Add new users. It creates two OVPN files - with and without proxy and also generates the URLs to download them. Safely use for existing users - it just creates the OVPN files.
#!/bin/bash -e
fatal() { echo "FATAL: $@" 1>&2; exit 1; }
warn() { echo "WARN: $@"; }
info() { echo "INFO: $@"; }
usage() {
cat <<EOF
Usage: sudo $0 client_or_profile_name
This will create two ovpn files in this directory (proxy and noproxy).
@gdarko
gdarko / 01_Laravel 5 Simple ACL manager_Readme.md
Created July 15, 2016 10:16 — forked from amochohan/01_Laravel 5 Simple ACL manager_Readme.md
Laravel 5 Simple ACL - Protect routes by an account / role type

#Laravel 5 Simple ACL manager

Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.

If the user has a 'Root' role, then they can perform any actions.

Installation

Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php

/**
* Be sure to include library scripts in this order. Can be placed either
* in the header or footer.
*/
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-infinitescroll/2.0b2.120519/jquery.infinitescroll.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/masonry/3.1.2/masonry.pkgd.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/3.0.4/jquery.imagesloaded.min.js"></script>
@gdarko
gdarko / nginx-latest.sh
Last active November 5, 2018 08:41 — forked from Globegitter/nginx-latest.sh
Install the latest nginx from source for Debian 8
# Automatically instal the latest nginx
wget -O - http://nginx.org/keys/nginx_signing.key | sudo apt-key add -
#Make a backup copy of your current sources.list file
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
#Now copy the following repositories to the end of ` /etc/apt/sources.list`
echo "deb http://nginx.org/packages/mainline/debian/ jessie nginx" | tee -a /etc/apt/sources.list
echo "deb-src http://nginx.org/packages/mainline/debian/ jessie nginx" | tee -a /etc/apt/sources.list