Skip to content

Instantly share code, notes, and snippets.

View emilsoman's full-sized avatar

Emil Soman emilsoman

View GitHub Profile
@emilsoman
emilsoman / producer.ex
Last active March 1, 2017 14:58
Inactivity based trigger for Flow
defmodule MyFlow.Producer do
use GenStage
def start_link do
GenStage.start_link(__MODULE__, nil, name: __MODULE__)
end
def push(user_id) do
GenStage.call(__MODULE__, {:push, user_id})
end
defmodule MyServer do
use GenServer
def start_link do
GenServer.start_link(__MODULE__, [], name: __MODULE__)
end
def kill do
GenServer.cast(__MODULE__, :stop)
end
@emilsoman
emilsoman / phoenix_to_umbrella
Last active April 12, 2024 11:26
How to move an existing phoenix app under an umbrella app
How to convert existing phoenix app to an umbrella app.
https://elixir-lang.slack.com/archives/phoenix/p1472921051000134
chrismccord [10:14 PM]
@alanpeabody yes, it's straightforward
[10:14]
1) mix new my_umbrella --umbrella
@emilsoman
emilsoman / CS GO custom settings
Last active January 20, 2017 14:47
CS GO custom config
// Launch options in steam
-novid +exec autoconfig.cfg -freq 144
@emilsoman
emilsoman / Dockerfile
Last active March 30, 2016 13:19
chatops_deployer setup for a simple Rails app
# Use ruby:2.2 as the base image since this is a Rails app
FROM <private_docker_registry>/ruby:2.2
# Install necessary packages for running rails and connecting to DB
RUN apt-get update -qq && apt-get install -y build-essential nodejs mysql-client
RUN mkdir /web
WORKDIR /web
# Copy the project
ADD . /web/
COPY config/database.docker.yml /web/config/database.yml
@emilsoman
emilsoman / zeus_wrapper.zsh
Created March 8, 2016 11:47
When exit status of zeus is 2, fix tty and retry.
zeus () {
ARGS=$@;
command zeus "$@";
ZE_EC=$?;
if [ $ZE_EC = 2 ]; then
stty sane;
zeus ${=ARGS};
fi
}
@emilsoman
emilsoman / wemux_pair.md
Created September 14, 2015 08:38
Pairing with Wemux

Pairing with Wemux

Just for future reference, here are the steps for pairing with wemux:

On host:

  1. Install wemux
  2. Create a new user on the OS, called 'pair'
  3. Add client's SSH public key to ~/.ssh/authorized_keys of 'pair' user we just created. Make sure sshd is running
  4. Log out of pair user, run wemux start as normal user.
#include <stdio.h>
int main(){
fprintf(stderr, "%s\n", "Study of int arrays");
fprintf(stderr, "%s\n", "===================");
int a[] = {1, 2, 3, 4, 5};
// Arrays are contiguous memory locations.
// The variable holding the array actually points to
// the first item in the array :
fprintf(stderr, "%p == %p\n", a, &a[0]);
@emilsoman
emilsoman / linux_time.c
Created November 5, 2014 20:10
Compiled with "gcc linux_time.c && ./a.out" , getting -> undefined reference to `clock_gettime'. Fixed using "gcc test_linux.c -Xlinker -lrt"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/time.h>
double get_wall_time(){
struct timeval tv;
gettimeofday(&tv, NULL);
return tv.tv_sec + (tv.tv_usec/1000000.0);
}
@emilsoman
emilsoman / tmux-layout.md
Created August 31, 2014 21:49
Easy tmux layouts for tmuxinator

Tmux layouts with tmuxinator

Finally this time, I'm sold on tmux after I used tmuxinator to configure tmux layouts. The default layout didn't work for me, I wanted more control on the split panes. Here's how you can fine tune your tmux layout:

  1. Add this to your ~/.tmux.conf -> set -g mouse-resize-pane on
  2. Start tmux, split panes, resize panes with mouse to your liking
  3. On your shell, run tmux list-windows to list active tmux windows and their layouts
  4. Copy paste the layout in tmuxinator project file