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
# Use an official Elixir runtime as a parent image | |
FROM elixir:latest | |
RUN apt-get update && \ | |
apt-get install -y postgresql-client && \ | |
apt-get install -y curl | |
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - | |
RUN apt-get install -y nodejs |
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 NiceBot.Bot do | |
@bot :nice_bot | |
use ExGram.Bot, | |
name: @bot | |
def bot(), do: @bot | |
def handle({:command, "start", _msg}, context) do | |
answer(context, "Hi!") |
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 NiceBot.Application do | |
use Application | |
def start(_type, _args) do | |
token = "378322483:AAFdz_7lJt69S5HO7ep2GgBqTc36AIo3Ouc" | |
children = [ | |
ExGram, | |
{NiceBot.Bot, [method: :polling, token: token]} | |
] |
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 NiceBot.Application do | |
# See https://hexdocs.pm/elixir/Application.html | |
# for more information on OTP Applications | |
@moduledoc false | |
use Application | |
def start(_type, _args) do | |
# List all child processes to be supervised | |
children = [ |
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
defp deps do | |
[ | |
{:ex_gram, "~> 0.6"}, | |
{:jason, "~> 1.1"} | |
] | |
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
defmodule NiceBot.MixProject do | |
use Mix.Project | |
def project do | |
[ | |
app: :nice_bot, | |
version: "0.1.0", | |
elixir: "~> 1.8", | |
start_permanent: Mix.env() == :prod, | |
deps: deps() |
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
(defun new-scratch-buffer-new-window () | |
"Create a new scratch buffer in a | |
new window. I generally take a lot of notes | |
in different topics. For each new topic hit | |
C-c C-s and start taking your notes. | |
Most of these notes don't need to be | |
saved but are used like quick post it | |
notes." | |
(interactive) | |
(let (($buf (generate-new-buffer "notes"))) |
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
#!/bin/sh | |
# | |
# This script uses rsstail to retrieve latests entries from Reddit Popular rss feed | |
# and process them through awk. Each update shows a timestamp separator. | |
# | |
# It will work with most RSS feeds out there. | |
# | |
if [ $# -eq 1 ]; then | |
subreddit="r/$1" |