Skip to content

Instantly share code, notes, and snippets.

@dstrctrng
dstrctrng / my_app.sh
Created February 20, 2014 21:22 — forked from guillermo/my_app.sh
#!/bin/bash
# This is a unix wrapper around the erlang vm. It provides the following functionality:
#
# * Spawns in foreground
# * Handle SIGHUP and call RELOADFUNC
# * Handle SIGTERM SIGQUIT and SIGINT telling to the vm to quit
# * Dies if the vm dies (for example kernel killing because out of memory)
#
# Forks and improvements are welcome.
@dstrctrng
dstrctrng / my_app.sh
Created February 20, 2014 21:22 — forked from guillermo/my_app.sh
#!/bin/bash
# This is a unix wrapper around the erlang vm. It provides the following functionality:
#
# * Spawns in foreground
# * Handle SIGHUP and call RELOADFUNC
# * Handle SIGTERM SIGQUIT and SIGINT telling to the vm to quit
# * Dies if the vm dies (for example kernel killing because out of memory)
#
# Forks and improvements are welcome.
gcc -o conftest -I../../.ext/include/x86_64-linux -I../.././include -I../.././ext/openssl -I/opt/br/br-admin/pkg/include/db4 -I/usr/include -I/opt/br/br-admin/pkg/include -I/opt/br/br-admin/pkg/include/db4 -I/usr/include -I/opt/br/br-admin/pkg/include -O2 -Wno-error -pthread -I/opt/br/br-admin/pkg/include/db4 -I/usr/include -I/opt/br/br-admin/pkg/include -fPIC conftest.c -L. -L../.. -L. -L/opt/br/br-admin/pkg/lib -Wl,-R/opt/br/br-admin/pkg/lib -pthread -rdynamic -Wl,-export-dynamic -lssl -lcrypto -Wl,-R -Wl,/opt/br/br-admin/pkg/lib -L/opt/br/br-admin/pkg/lib -lruby193-static -lssl -lcrypto -lpthread -lrt -ldl -lcrypt -lm -lpthread -lrt -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <ruby.h>
4:
5: /*top*/
6: int main(int argc, char **argv)
7: {
have_func: checking for rb_str_set_len() in ruby.h... -------------------- no
"gcc -o conftest -I../../.ext/include/x86_64-linux -I../.././include -I../.././ext/openssl -I/opt/br/br-admin/pkg/include/db4 -I/usr/include -I/opt/br/br-admin/pkg/include -I/opt/br/br-admin/pkg/include/db4 -I/usr/include -I/opt/br/br-admin/pkg/include -O2 -Wno-error -pthread -I/opt/br/br-admin/pkg/include/db4 -I/usr/include -I/opt/br/br-admin/pkg/include -fPIC conftest.c -L. -L../.. -L. -L/opt/br/br-admin/pkg/lib -Wl,-R/opt/br/br-admin/pkg/lib -pthread -rdynamic -Wl,-export-dynamic -L/usr/lib64 -lssl -lcrypto -Wl,-R -Wl,/opt/br/br-admin/pkg/lib -L/opt/br/br-admin/pkg/lib -lruby193-static -lssl -lcrypto -lpthread -lrt -ldl -lcrypt -lm -lpthread -lrt -lc"
../../libruby193-static.a(string.o): In function `rb_str_crypt':
string.c:(.text+0xa510): undefined reference to `crypt'
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
@dstrctrng
dstrctrng / gpkg.sh
Last active December 26, 2015 02:09
Gist as version control, packaging for simple scripts.
#!/usr/bin/env bash
#/ NAME
#/ gpkg -- manages gist packages
#/
#/ SYNOPSIS
#/ gpkg install [gist_id | archive]
#/ gpkg update [gist_id | archive]
#/ gpkg package [gist_id]
#/ gpkg exec [name]
curl http://curl.haxx.se/ca/cacert.pem | while read -r a; do
[[ "$a" = "-----BEGIN CERTIFICATE-----" ]] && { echo "$a" > cert; continue; }
[[ "$a" = "-----END CERTIFICATE-----" ]] && { echo "$a" >> cert; mv cert $(openssl x509 -hash -noout -in cert).0; }
[[ -f cert ]] && echo "$a" >> cert
done
> ssh bastion
root@8cb2ee8bb517:/# ps axuf
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.3 0.0 18156 2072 ? S 23:03 0:00 bash
root 10 0.0 0.0 15280 1056 ? R+ 23:03 0:00 ps axuf
root@8cb2ee8bb517:/# exit
> ssh bastion
root@adf50ae964a3:/# ps axuf
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
> ssh bastion
root@8cb2ee8bb517:/# ps axuf
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.3 0.0 18156 2072 ? S 23:03 0:00 bash
root 10 0.0 0.0 15280 1056 ? R+ 23:03 0:00 ps axuf
root@8cb2ee8bb517:/# exit
> ssh bastion
root@adf50ae964a3:/# ps axuf
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
Bringing machine 'default' up with 'docker' provider...
[default] Launching an instance with the following settings...
[default] -- Image: 9014505bebb4
[default] Waiting for instance to become "ready"...
[default] Waiting for SSH to become available...
[default] Machine is booted and ready for use!
env BOX=precise-base vagrant ssh -- -A
Welcome to Ubuntu 12.04.3 LTS (GNU/Linux 3.8.0-30-generic x86_64)
* Documentation: https://help.ubuntu.com/
"Ec2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"KeyName" : { "Ref" : "KeyName" },
"SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ],
"ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]},
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["",[
"#!/bin/bash -ex","\n",
"yum -y install gcc-c++ make","\n",
"yum -y install mysql-devel sqlite-devel","\n",