Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View johannesE's full-sized avatar
🎶
Living the dream on the BEAM

Johannes johannesE

🎶
Living the dream on the BEAM
View GitHub Profile
@johannesE
johannesE / pulseaudio.5s.sh
Last active June 6, 2019 07:48
pulseaudo-dlna with argos
#!/usr/bin/env bash
if pgrep -x "pulseaudio-dlna" >/dev/null
then
echo ":musical_note: <span color='green'>running</span>"
else
echo ":musical_note: <span color='red'>stopped</span>"
fi
echo "---"
echo "Start | bash='pulseaudio-dlna --auto-reconnect' iconName=media-playback-start terminal=false color=green"
echo "Stop | bash='pkill pulseaudio-dlna' iconName=media-playback-stop terminal=false color=red"
@johannesE
johannesE / belongs_to_plug.ex
Last active December 19, 2018 13:08
Plug to check that a user modifies only his files.
defmodule AppWeb.BelongsToPlug do
@moduledoc """
This plug makes sure that a user modifies only his resources based on the user_id of the model.
"""
def init(options), do: options
def call(conn = %Plug.Conn{method: "DELETE"}, _options) do
raise "This Plug should not be used for deletion checking because it's impossible to figure out what model(s) the user wishes to delete."
end
@johannesE
johannesE / result
Last active December 13, 2017 19:44
elixir meetup input string
2373699914823461246633952863546729854573268657485334121797781883978352795841499719997985122794292687271717554614189745585382464299867475324178461575265232389313518985482795494566944884334389827447822582791733233815719854542365693939757357153314382567955795141599465378683587359368324874229386781947576876981432241392431512224751313371358437936117423832671861586657269279676555838754855155126261429353574218529537757337489419269833777253861961874861313374585748298487237113559296846252235644894855975647683174328938366292552734527762323192654225334495499562447915655737277626874392218626327222771296133291671898749394142985846164968392232391972775636418537461932325432228132981951693451864998661475865597815238345956834961515815468291127455333477962136738149958491563216743796443231592591319254449612968211674836288123953915335725556241599392791253413351472346535729773455821357289943956316856181355636626898546919768434357858799527512666276456539812818916438237175287573411367478815186114392468773739357581511191855879213321
#!/usr/bin/env bash
mix ecto.migrate
exec mix phoenix.server