This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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://gist.githubusercontent.com/sheharyarn/ee440fdf7258db79c39e1ebb020d473b/raw/motion_light_or_switch.yaml | |
author: Sheharyar Naseer + Home Assistant | |
input: | |
motion_entity: | |
name: Motion Sensor | |
selector: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mix.install([{:plug_cowboy, "~> 2.0"}]) | |
defmodule Server do | |
use Plug.Router | |
plug(:match) | |
plug(:dispatch) | |
match _ do | |
send_resp(conn, 200, "Hello World!") | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function respondToEmails() { | |
//var filter = 'from:(some.email@address.com) AND -label:"Auto-Replied"'; | |
var filter = 'label:"Job Proposals" AND -label:"Auto-Replied"'; | |
var completeLabel = GmailApp.getUserLabelByName("Auto-Replied"); | |
var threads = GmailApp.search(filter); | |
var replyFrom = "Recruiter Bot <your.email+recruiterbot@gmail.com>"; | |
val realEmail = "your.real@email.com" | |
var formLink = "https://link.to/your/form" | |
var response = ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dev Local Conf for multiple subdomain websites | |
# Here `appdev.com` is pointing to 127.0.0.1 | |
#resolver 127.0.0.11 valid=5s; # for docker | |
ssl_certificate /usr/local/etc/nginx/ssl/app.server.crt; | |
ssl_certificate_key /usr/local/etc/nginx/ssl/app.server.key; | |
upstream app_backend { server localhost:4000; } | |
upstream app_website { server localhost:5001; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule TwitterDeleter do | |
@tweet_data Path.expand("~/Downloads/twitterdump/assets/tweet.js") | |
@cutoff Date.from_iso8601!("2015-01-01") | |
@call_limit 3000 | |
@chunk_no 3 | |
require Logger | |
def run do | |
file = File.read!(@tweet_data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Elixir Artifacts | |
/_build/ | |
/deps/ | |
/doc/ | |
/cover/ | |
/.fetch | |
*.ez | |
APPNAME-*.tar | |
erl_crash.dump |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build the release | |
# ----------------- | |
FROM elixir:1.9.0-alpine as build | |
ENV MIX_ENV=prod | |
WORKDIR /source | |
RUN mix local.hex --force && mix local.rebar --force | |
# Cache dependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Custom Implementation of React Context to manage | |
* global application state | |
* | |
* @author Sheharyar Naseer (@sheharyarn) | |
* @license MIT | |
* | |
* Normal Usage: | |
* | |
* ``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Flatten do | |
@doc """ | |
Flattens a List in Elixir | |
## Examples | |
``` | |
Flatten.flatten([1,2,3,4]) | |
# => [1,2,3,4] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Memoize do | |
@moduledoc """ | |
Simple memoization helper built on top of FastGlobal. | |
Remember to add `{:fastglobal, "~> 1.0"}` to your | |
dependencies first. | |
## Usage |
NewerOlder