Skip to content

Instantly share code, notes, and snippets.

View dragosdm's full-sized avatar
🏠
Working from home

Dragoș Mușetescu dragosdm

🏠
Working from home
View GitHub Profile
@dragosdm
dragosdm / config.el
Created October 30, 2020 12:48 — forked from darioghilardi/config.el
Doom-Emacs Elixir config
;; Elixir configuration
;; Start by configuring Alchemist for some tasks.
(def-package! alchemist
:hook (elixir-mode . alchemist-mode)
:config
(set-lookup-handlers! 'elixir-mode
:definition #'alchemist-goto-definition-at-point
:documentation #'alchemist-help-search-at-point)
(set-eval-handler! 'elixir-mode #'alchemist-eval-region)
(set-repl-handler! 'elixir-mode #'alchemist-iex-project-run)
@dragosdm
dragosdm / esh-custom.el
Created October 26, 2020 13:16 — forked from ekaschalk/esh-custom.el
Customizing your emacs shell.
(require 'dash)
(require 's)
(defmacro with-face (STR &rest PROPS)
"Return STR propertized with PROPS."
`(propertize ,STR 'face (list ,@PROPS)))
(defmacro esh-section (NAME ICON FORM &rest PROPS)
"Build eshell section NAME with ICON prepended to evaled FORM with PROPS."
`(setq ,NAME
@dragosdm
dragosdm / nginx-alertmanager-prometheus
Created September 26, 2020 09:32 — forked from flaviocarmo/nginx-alertmanager-prometheus
Nginx reverse proxy for Prometheus and Alertmanager
upstream @prometheus {
server MY_IP:9090;
}
upstream @alertmanager {
server MY_IP:9093;
}
server {
listen 80;
@dragosdm
dragosdm / postgres-cheatsheet.md
Created June 20, 2019 23:17 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)

Keybase proof

I hereby claim:

  • I am dragosdm on github.
  • I am dragosdm (https://keybase.io/dragosdm) on keybase.
  • I have a public key whose fingerprint is 83D5 F991 17FD 7FBE 2F51 257A D96B 59CD 34D5 DC9F

To claim this, I am signing this object:

@dragosdm
dragosdm / Dockerfile
Created July 25, 2017 17:40 — forked from bsedat/Dockerfile
Elixir Phoenix Umbrella App + Distillery Multistage Docker Build
FROM elixir:1.4.5 as asset-builder-mix-getter
ENV HOME=/opt/app
RUN mix do local.hex --force, local.rebar --force
# Cache elixir deps
COPY config/ $HOME/config/
COPY mix.exs mix.lock $HOME/
COPY apps/myproject_web/mix.exs $HOME/apps/myproject_web/
COPY apps/myproject_web/config/ $HOME/apps/myproject_web/config/
@dragosdm
dragosdm / settle-felony-charges.js
Created May 5, 2016 16:58 — forked from sgaurav/settle-felony-charges.js
Sending personal responses through FB Messenger bot
app.post('/webhook/', receiveMessage);
function receiveMessage(req, res, next){
var message_instances = req.body.entry[0].messaging;
message_instances.forEach(function(instance){
var sender = instance.sender.id;
if(instance.message && instance.message.text) {
fetchUserProfileAndReply(sender, conf.PROFILE_TOKEN);
}
});
<?php defined('BASEPATH') or exit('No direct script access allowed');
class Community extends Public_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()