Skip to content

Instantly share code, notes, and snippets.

@zhiyelee
zhiyelee / hammerspoon_app_shortcut.lua
Created June 7, 2020 16:24
Hammerspoon app lunch shortcut
--- start quick open applications
function open_app(name)
return function()
hs.application.launchOrFocus(name)
if name == 'Finder' then
hs.appfinder.appFromName(name):activate()
end
end
end
@evgeniy-trebin
evgeniy-trebin / brew_elasticsearch.sh
Last active September 21, 2022 22:39
How to install specific version of elasticsearch via brew
brew tap homebrew/versions
brew cask install java
brew search elasticsearch
brew install elasticsearch@2.3
brew services start elasticsearch@2.3
@mike-north
mike-north / run phoenix on amazon linux.sh
Last active August 27, 2021 12:17 — forked from eikes/run phoenix on amazon linux.sh
run phoenix on amazon linux
# app deps
sudo yum install git
# erlang deps
sudo yum groupinstall "Development Tools"
sudo yum install ncurses-devel openssl-devel
# erlang
wget http://www.erlang.org/download/otp_src_19.2.tar.gz
tar -zxvf otp_src_19.2.tar.gz
@techgaun
techgaun / erlang-elixir-on-amazon-linux.md
Last active November 21, 2023 03:09
Running elixir 1.8.1 on amazon linux

Script

#!/bin/bash

yum install ncurses-devel openssl-devel -y
yum groupinstall "Development Tools" -y

cd /tmp
wget "http://erlang.org/download/otp_src_21.3.tar.gz" -O otp21.tar.gz
@mverzilli
mverzilli / circle.yml
Created June 15, 2016 14:35
CircleCI for Crystal Projects
# Include this file in your project's root folder to integrate with CircleCI.
# Replace 0.18.0 with the Crystal version you're using.
dependencies:
cache_directories:
- "crystal-0.18.0-1"
pre:
- if [[ ! -e crystal-0.18.0-1 ]]; then wget https://github.com/crystal-lang/crystal/releases/download/0.18.0/crystal-0.18.0-1-linux-x86_64.tar.gz && tar xvfz crystal-0.18.0-1-linux-x86_64.tar.gz; fi
test:
pre:
- crystal-0.18.0-1/bin/crystal deps
@eikes
eikes / run phoenix on amazon linux.sh
Created December 28, 2015 22:29
run phoenix on amazon linux
# app deps
sudo yum install git
# erlang deps
sudo yum groupinstall "Development Tools"
sudo yum install ncurses-devel
# erlang
wget http://www.erlang.org/download/otp_src_18.1.tar.gz
tar -zxvf otp_src_18.1.tar.gz
@FND
FND / content_negotiator.ex
Last active December 12, 2017 05:06
Phoenix content negotiation
defmodule ContentNegotiator do
def init(opts), do: opts
def call(conn, opts) do
conn
|> Phoenix.Controller.accepts(Map.keys(opts))
|> dispatch_by_accept(opts)
end
@notozeki
notozeki / Makefile
Last active March 22, 2023 16:27
An example Ruby extension written in Crystal
CRYSTAL = crystal
UNAME = "$(shell uname -ms)"
LIBRARY_PATH = $(shell brew --prefix crystal-lang)/embedded/lib
LIBS = -levent -lpcl -lpcre -lgc -lpthread
LDFLAGS = -Wl,-undefined,dynamic_lookup
TARGET = crystal_example_ext.bundle
$(TARGET): crystal_example_ext.o
$(CC) -bundle -L$(LIBRARY_PATH) -o $@ $^ $(LIBS) $(LDFLAGS)
@olivierlacan
olivierlacan / migrate_postgresql_database.md
Last active March 24, 2022 20:30
How to migrate a Homebrew-installed PostgreSQL database to a new major version (9.3 to 9.4) on OS X. See upgraded version of this guide: http://olivierlacan.com/posts/migrating-homebrew-postgres-to-a-new-version/

This guide assumes that you recently run brew upgrade postgresql and discovered to your dismay that you accidentally bumped from one major version to another: say 9.3.x to 9.4.x. Yes, that is a major version bump in PG land.

First let's check something.

brew info postgresql

The top of what gets printed as a result is the most important:

@boopathi
boopathi / README.md
Last active August 28, 2023 14:35
Creating a Swift-ReactNative project

Settings

  1. Create a project in XCode with the default settings
    • iOS > Application > Single View Application
    • Language: Swift
  2. Under project General settings, add ReactKit to Linked Framework and Libraries
    • + > Add Other... and choose /path/to/react-native/ReactKit/ReactKit.xcodeproj
  3. Now ReactKit would have been imported. Link it by choosing it from the list.
    • + > lib.ReactKit.a
  4. Under project Build Settings,