Skip to content

Instantly share code, notes, and snippets.

View orderthruchaos's full-sized avatar

Brett DiFrischia orderthruchaos

View GitHub Profile

Phoenix 1.4.x to 1.5.0 upgrade instructions

Phoenix 1.5 requires Elixir >= 1.7. Be sure your existing version is up to date by running elixir -v on the command line.

Install the new phx.new project generator

$ mix archive.uninstall phx_new
$ mix archive.install hex phx_new 1.5.0
@dglaude
dglaude / code.py
Last active April 13, 2023 20:50
CircuitPython: PyGamer + MLX90640 = Portable Thermal Camera
import time
import board
import busio
import adafruit_mlx90640
import displayio
number_of_colors = 13
palette = displayio.Palette(number_of_colors) # Palette with all our colors
@steven2358
steven2358 / ffmpeg.md
Last active November 11, 2024 04:45
FFmpeg cheat sheet
defmodule GCM.Pusher do
use GenStage
# The maximum number of requests Firebase allows at once per XMPP connection
@max_demand 100
defstruct [
:producer,
:producer_from,
:fcm_conn_pid,
:pending_requests,
defmodule GCM.PushCollector do
use GenStage
# Client
def push(pid, push_requests) do
GenServer.cast(pid, {:push, push_requests})
end
# Server
@ulve
ulve / install_phoenix.sh
Last active February 1, 2021 19:21
Install Erlang/Elixir/Phoenix on a Raspberry Pi
#!/bin/bash
sudo apt-get update
sudo apt-get --assume-yes install wget
sudo apt-get --assume-yes install libssl-dev
sudo apt-get --assume-yes install ncurses-dev
sudo apt-get --assume-yes install m4
# erlang
wget http://erlang.org/download/otp_src_18.2.tar.gz
tar -xvzf otp_src_18.2.tar.gz
cd otp_src_18.2
@whatyouhide
whatyouhide / testing_defps.ex
Created January 7, 2016 22:26
Testing private functions in Elixir
defmodule TestDefp do
defmacro __using__(_) do
quote do
import Kernel, except: [defp: 2]
end
end
# Let's redefine `defp/2` so that if MIX_ENV is `test`, the function will be
# defined with `def/2` instead of `defp/2`.
defmacro defp(fun, body) do
@bvandgrift
bvandgrift / let-placement.clj
Created January 7, 2016 18:24
placing your peek inside of a dosync avoids potential thread conflict (from Clojure Applied forum)
;; response to: https://forums.pragprog.com/forums/352/topics/13835
;; this is a quick demonstration of the pitfalls in querying for a ref
;; outside of the accompanying transaction in which you plan on changing it.
(import '(java.util.concurrent Executors))
;; start list
(def slist (ref #{}))
@Shoozza
Shoozza / agent.cmd
Last active April 20, 2022 02:45
Make Cmder work with ssh-agent
@ECHO OFF
SETLOCAL
GOTO:MAIN
REM
REM Info functions start
REM
REM Display version and copyright information
:VERSION
@pnc
pnc / observer.md
Last active August 9, 2024 08:35
Using Erlang observer/appmon remotely

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host