Skip to content

Instantly share code, notes, and snippets.

View danhper's full-sized avatar

Daniel Perez danhper

View GitHub Profile
@danhper
danhper / sourcenv.fish
Created June 11, 2017 13:44
Small fish function to source a file with a dotenv format
function sourcenv -a file
cat $file | sed -e 's/\(^\|export \)/set -xg /' -e 's/=/ /' | source
end
#!/bin/bash
PACKAGE=$1
BASE_URL=http://ftp.jaist.ac.jp/pub/Linux/ubuntu
BASE_PATH=$HOME/install_root
DEB="$PACKAGE.deb"
path=$(apt-cache show $PACKAGE | grep "Filename:" | cut -f 2 -d " ")
wget $BASE_URL/$path -O $DEB
dpkg-deb -x "$DEB" $BASE_PATH
import sqlalchemy
from sqlalchemy.orm import sessionmaker
from sqlalchemy import Column, Integer, String, Text, DateTime
from sqlalchemy.ext.declarative import declarative_base
engine = sqlalchemy.create_engine("sqlite:///foo.db", echo=True)
Base = declarative_base()
@danhper
danhper / archlinux-link-openssl1-0.sh
Created May 15, 2017 01:02
Link OpenSSL 1.0 to a directory on ArchLinux
@danhper
danhper / gitlab-to-bitbucket.py
Last active September 24, 2024 09:41
Script to migrate repositories from GitLab to Bitbucket
import os
import re
import subprocess
import requests
GITLAB_ENDPOINT = os.environ["GITLAB_ENDPOINT"]
GITLAB_TOKEN = os.environ["GITLAB_TOKEN"]
@danhper
danhper / fabfile.py
Created March 20, 2017 00:26
Sample fabfile to deploy to AWS (with closed firewall) from CI servers
from contextlib import contextmanager
import boto3
IP_CHECK_URL = "http://checkip.amazonaws.com/"
BASTION_SECURITY_GROUP_NAME = "the security group name of your bastion or server"
EC2_REGION = "us-east-1" # or whatever you are deploying to
ec2 = boto3.client("ec2", EC2_REGION)
hKRib2R5hqhkZXRhY2hlZMOpaGFzaF90eXBlCqNrZXnEIwEg3nQ4DA/KK/FfgQ41je8KlpKsYBUVWRr5yToexvJSUAcKp3BheWxvYWTFAvB7ImJvZHkiOnsia2V5Ijp7ImVsZGVzdF9raWQiOiIwMTIwZGU3NDM4MGMwZmNhMmJmMTVmODEwZTM1OGRlZjBhOTY5MmFjNjAxNTE1NTkxYWY5YzkzYTFlYzZmMjUyNTAwNzBhIiwiaG9zdCI6ImtleWJhc2UuaW8iLCJraWQiOiIwMTIwZGU3NDM4MGMwZmNhMmJmMTVmODEwZTM1OGRlZjBhOTY5MmFjNjAxNTE1NTkxYWY5YzkzYTFlYzZmMjUyNTAwNzBhIiwidWlkIjoiODA2NzE3ZTcxN2ExZDQ5MmVjNmQzNjk2YjYyYzYxMTkiLCJ1c2VybmFtZSI6InR1dmlzdGF2aWUifSwic2VydmljZSI6eyJuYW1lIjoiZ2l0aHViIiwidXNlcm5hbWUiOiJ0dXZpc3RhdmllIn0sInR5cGUiOiJ3ZWJfc2VydmljZV9iaW5kaW5nIiwidmVyc2lvbiI6MX0sImNsaWVudCI6eyJuYW1lIjoia2V5YmFzZS5pbyBnbyBjbGllbnQiLCJ2ZXJzaW9uIjoiMS4wLjE3In0sImN0aW1lIjoxNDc1Nzk4NDU2LCJleHBpcmVfaW4iOjUwNDU3NjAwMCwibWVya2xlX3Jvb3QiOnsiY3RpbWUiOjE0NzU3OTg0MDYsImhhc2giOiIzNzk3YjAxYjRlNDk2ZTM3MGI3M2VlZjcwZDA3ZDRjNzQ2ZmQ0ZTk1NzY5YjVlNWNhYjMwYTg0MWNkNDNkNWMwMTkyYTcxMDI3YjY1MDY5ZGY0MDIyOTAwMzFkODk3NDYzMDFiZDI1YTg4ZTk1YTZjNDVmOTg3Nzc2YTI4Nzg2YiIsInNlcW5vIjo2Njc1NzZ9LCJwcmV2IjoiNGZjZGI1Zjg5OGIzMWM3NjM1ZGVlZWFjNTgwNDBk
test -d elixir || git clone git://github.com/elixir-lang/elixir.git --depth 1 --single-branch --branch master
pushd elixir
echo -e 'erlang 18.3' > .tool-versions
echo $(which erl)
echo $(asdf which erlang)
erl +V
popd
#!/bin/bash
version="7.0.7"
fallback_mirror="http://us1.php.net/get/php-$version.tar.bz2/from/this/mirror"
mirrors=$(curl -s https://secure.php.net/get/php-$version.tar.bz2/from/a/mirror | grep -Eo 'http://.+/from/this/mirror')
country=$(curl -s ipinfo.io | sed -n 's/\s*"country": "\(.\+\)",/\1/p' | tr '[:upper:]' '[:lower:]')

Changes for Elixir 1.3

  • Deprecation of imperative assignment
  • with improvements
    • Possibility to use guards
    • Possibility to use else
  • Date datatypes
  • Addition of escript installation related tasks
  • ExUnit diff improvements
  • Addition of Make compiler