Skip to content

Instantly share code, notes, and snippets.

View mchavezi's full-sized avatar
🎯
Focusing

Michael A Chavez mchavezi

🎯
Focusing
View GitHub Profile
**lib/sequin/databases/sequence.ex**
```elixir
defmodule Sequin.Databases.Sequence do
@moduledoc false
use Sequin.ConfigSchema
import Ecto.Changeset
import Ecto.Query
alias Sequin.Consumers.SinkConsumer
- name: get the username running the deploy
become: false
local_action: command whoami
register: username_on_the_host
- debug: var=username_on_the_host
This file has been truncated, but you can view the full file.
#Fields: timestamp time-taken c-ip filesize s-ip s-port sc-status sc-bytes cs-method cs-uri-stem - rs-duration rs-bytes c-referrer c-user-agent customer-id x-ec_custom-1
1523756544 3 86.45.165.83 1845784 152.195.141.240 80 TCP_HIT/200 1846031 GET http://example.com/04C0BF/v2/sources/content-owners/sgl-entertainment/275211/v0401185814-1389k.mp4+740005.ts - 0 486 "-" "ItubExoPlayer/2.12.9 (Linux;Android 6.0) ExoPlayerLib/2.4.2" 49343 "-"
1523756611 58 86.165.81.111 3364824 152.195.141.240 80 TCP_HIT/200 3365071 GET http://example.com/04C0BF/v2/sources/content-owners/sgl-entertainment/326260/v20169101326-1256x544-3063k.mp4+3713710.ts - 0 616 "-" "Mozilla/5.0 (Linux; Android 5.1.1; AFTT Build/LVY48F; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/55.0.2883.91 Mobile Safari/537.36" 49343 "-"
1523756639 3 88.110.35.157 2227424 152.195.141.240 80 TCP_HIT/200 2227671 GET http://example.com/04C0BF/v2/sources/content-owners/cinedigm-tubi/398629/v201711170053-2061k.mp4+4582327.ts - 0 604 "-" "Mozilla/5.
@mchavezi
mchavezi / cf-invalidate.md
Last active October 4, 2020 10:10
AWS Lamda that invalidates CloudFront

index.js

const AWS = require('aws-sdk')
const cf = new AWS.CloudFront()

const invalidate = async (event) => {

	const timestamp = Math.round(+new Date()/1000).toString(),
		query = event.queryStringParameters,
		dist_id = query.dist_id,

I want to replace occurances of <%= svg_image("something anything") %> with nothing.

find

<%= svg_image(.*?)%>

replace

svg_image_placeholder_for$1

html

<div id="grid">
  <div id="item1"></div>
  <div id="item2"></div>
  <div id="item3"></div>
  <div id="item4"></div>
  <div id="item5"></div>
</div>
<select id="direction" onchange="changeGridAutoFlow()">

Schema

  • title
  • caption
  • alt text
  • description
  • uploaded_by

derived:

  • File name: phoenix.png
  • File type: image/png
defmodule MyApp.Registration do
@moduledoc """
The Registration context.
"""
alias MyApp.Subdomain.Accounts
alias MyApp.Orgs
alias MyApp.Tenants.Tenant
def create(attrs) do
case Orgs.register_org(attrs) do
defmodule MyApp.Registration do
@moduledoc """
The Registration context.
"""
alias MyApp.Subdomain.Accounts
alias MyApp.Orgs
def create(attrs) do
case Orgs.register_org(attrs) do
{:ok, org} ->
defmodule MyApp.Registration do
@moduledoc """
The Registration context.
"""
alias Ecto.Multi
alias MyApp.Repo
alias MyApp.Subdomain.Accounts
alias MyApp.Orgs
alias MyApp.Accounts.User
alias MyApp.Orgs.Org