Skip to content

Instantly share code, notes, and snippets.

@lessless
lessless / find_non_existing_set.ex
Created September 5, 2023 13:51
ecto find_non_existing_set
# courtesy @mrdotb
defmodule T do
import Ecto.Query
alias Your.Repo
@doc """
Use runtime data as an adhoc db table to join to data.
`types` need to be a compile time string literal.
`values` can be runtime supplied.

Keybase proof

I hereby claim:

  • I am lessless on github.
  • I am lessless (https://keybase.io/lessless) on keybase.
  • I have a public key ASDbUKvZIJvog5Mlht_iCeHuxEbx1u6lZmA_A-EEJbNyPQo

To claim this, I am signing this object:

@lessless
lessless / settings.json
Last active May 5, 2020 09:50
sublime config
{
"always_show_minimap_viewport": true,
"auto_find_in_selection": true,
"bold_folder_labels": true,
"caret_style": "wide",
"close_windows_when_empty": false,
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow Night.sublime-color-scheme",
"copy_with_empty_selection": false,
"create_window_at_startup": false,
"detect_indentation": true,
#!/bin/bash
# Name: build.lib.sh
# Author: Ladar Levison
#
# Description: Used to compile the external dependencies required by magma, and combine them into the magmad.so shared object file.
# Preliminary Dependency Matrix
# bzip2 -:-

Keybase proof

I hereby claim:

  • I am lessless on github.
  • I am lessless (https://keybase.io/lessless) on keybase.
  • I have a public key ASC8pryUCClC3vPid1p7vrR3-R4oscimVjWnqJ5CjNTgAgo

To claim this, I am signing this object:

Using elm-starter kit and GMaps JavaScript API create a program, which will display a map with a marker on the left
and marker coordinates on the right.
JavaScript is responsible for drawing map, listening to a marker position change and sending updated coordinates to the
Elm program. Elm program will just output updated coordinates on the page.
Possible visual appearance: http://www.awesomescreenshot.com/image/1303608/46dc61234e7baab90cb022ec7ccbd0b4
Things that will help you get started:
- Making Web functional https://www.youtube.com/watch?v=XJ9ckqCMiKk#t=28m40s (since 28m 40s)
- Elm starter kit https://github.com/splodingsocks/elm-starter
@lessless
lessless / elixir.sh
Created June 2, 2016 09:38
Codeship Elixir script
#!/bin/bash
# Totally c&p from various places all accross Internet
#
# Erlang
ERLANG_VERSION=${ERLANG_VERSION:-18.3}
ERLANG_CACHED_DOWNLOAD="${HOME}/cache/OTP-${ERLANG_VERSION}.tar.gz"
ERLANG_DIR=${ERLANG_DIR:="$HOME/erlang"}
# Elixir
#!/usr/bin/env bash
DB_MASTER=xxx
DB_BACKUP=yyy
# server
iptables -A INPUT -p tcp -s $DB_BACKUP --sport 1024:65535 -d $DB_MASTER --dport 5432 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s $DB_MASTER --sport 5432 -d $DB_BACKUP --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT
#client
iptables -A OUTPUT -p tcp -s $DB_MASTER --sport 1024:65535 -d 0/0 --dport 5432 -m state --state NEW,ESTABLISHED -j ACCEPT