Skip to content

Instantly share code, notes, and snippets.

View JarenGlover's full-sized avatar
💭
"robus nonformists with the courage of conviction"

Jaren Glover JarenGlover

💭
"robus nonformists with the courage of conviction"
View GitHub Profile
@JarenGlover
JarenGlover / gist:6d0e17d43effe0e1cfba
Last active August 29, 2015 14:07
CoreOS - OSx + Vagrant
6:13 pm est update
core@core-01 ~ $ curl -L http://127.0.0.1:4001/v1/keys/message -d value="Hello world"
{"errorCode":300,"message":"Raft Internal Error","index":1}
core@core-01 ~ $ /bin/etcd
[etcd] Sep 28 22:12:41.106 WARNING | Using the directory core-01.etcd as the etcd curation directory because a directory was not specified.
[etcd] Sep 28 22:12:41.107 INFO | The path core-01.etcd/log is in btrfs
[etcd] Sep 28 22:12:41.108 INFO | Set NOCOW to path core-01.etcd/log succeeded
[etcd] Sep 28 22:12:41.109 INFO | core-01 is starting a new cluster
[etcd] Sep 28 22:12:41.111 INFO | etcd server [name core-01, listen on :4001, advertised url http://127.0.0.1:4001]
[etcd] Sep 28 22:12:41.111 CRITICAL | Failed to create listener: listen tcp :4001: bind: address already in use
@JarenGlover
JarenGlover / gist:7667765bd14a3a165681
Created December 7, 2014 07:47
Postgres + JSON Example
CREATE TABLE json_test (id SERIAL, data JSON);
@JarenGlover
JarenGlover / JSON-->Iterable object (List).py
Last active August 29, 2015 14:12
JSON --> Iterable object (List)
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> numbers = '[20.0, 30.0, 40.0, 20.0, 30.0, 40.0, 35.0, 10.0, 0.0, 15.0, 25.0, 30.0, 10.0, 35.0, 30.0, 30.0, 30.0, 40.0, 25.0, 30.0, 35.0, 15.0, 65.0, 20.0]'
>>> type(numbers)
<type 'str'>
>>> numbers.strip(r'[|]')
'20.0, 30.0, 40.0, 20.0, 30.0, 40.0, 35.0, 10.0, 0.0, 15.0, 25.0, 30.0, 10.0, 35.0, 30.0, 30.0, 30.0, 40.0, 25.0, 30.0, 35.0, 15.0, 65.0, 20.0'
>>> numbers_strip = numbers.strip(r'[]')
>>> map(float,numberes_strip.split(','))
@JarenGlover
JarenGlover / gist:b8b34d80719a1b88b3cb
Last active August 29, 2015 14:12
Nginx - Serving Static Files at Root
server {
listen IP:PORT;
server_name .resume.jarenglover.com;
access_log /path/to/logs/resume-access.log default_uri; # <- "default_ui" is a parameter for customize Nginx logs
error_log /path/to/logs/resume-error.log;
index /Resume.pdf; #this sets the index location of what file will be servered
root /path/to/resume/; # root folder for this server block
location / {
@JarenGlover
JarenGlover / gist:d7ffab312ea756834218
Last active August 9, 2024 06:08
Nginx - Reverse Proxy | Backend & Front End Example
upstream fuel {
# Defines a group of servers. Servers can listen on different ports.
server IP:PORT fail_timeout=0;
}
upstream frontend {
server IP:PORT fail_timeout=0;
}
@JarenGlover
JarenGlover / gist:a7441771f07469375f30
Last active August 29, 2015 14:12
JSON --> Iterable object (List) 2.0
# improvement on how to build a dic from a string
# -> http://www.jarenglover.com/post/106593630960/creating-iterable-objects
# http://stackoverflow.com/questions/988228/converting-a-string-to-dictionary
# this only works if you know it will be valued JSON
>>> import ast
>>> line
'{"domain": {}, "buzz": "", "userid": 0.0, "hours": [20.0, 30.0, 40.0, 20.0, 30.0, 40.0, 35.0, 10.0, 0.0, 15.0, 25.0, 30.0, 10.0, 35.0, 30.0, 30.0, 30.0, 40.0, 25.0, 30.0, 35.0, 15.0, 65.0, 20.0], "buzzid": 0.0, "user": "", "time": 15736, "query": {}, "total": 660.0, "type": 0.0}\n'
>>> type(line)
<type 'str'>
@JarenGlover
JarenGlover / config for vim 7.4.582 with lua on ubuntu 14.04.sh
Last active August 29, 2015 14:13 — forked from seyDoggy/config for vim 7.4 with lua on ubuntu 13.04
I was having trouble getting lua support while rolling my own vim 7.4 on ubuntu 14.04.
#!/usr/bin/env bash
#run with a user with sudoers privilege
#update before apt-get
sudo apt-get update
#install lua (please note 5.3 was released in 2015)
sudo apt-get install lua5.2 liblua5.2
@JarenGlover
JarenGlover / vim74_lua
Last active August 29, 2015 14:14 — forked from jdewit/vim74_lua
sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-common vim-gui-common
sudo apt-get install python-dev
sudo apt-get build-dep vim-gnome
sudo apt-get install liblua5.1-dev luajit libluajit-5.1 python-dev ruby-dev libperl-dev mercurial libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev
sudo rm -rf /usr/local/share/vim
sudo rm /usr/bin/vim
@JarenGlover
JarenGlover / Dockerfile
Created April 5, 2015 04:50
Postgres & Bowery
#
# example Dockerfile for http://docs.docker.com/examples/postgresql_service/
#
FROM ubuntu
MAINTAINER [email protected]
# Add the PostgreSQL PGP key to verify their Debian packages.
# It should be the same key as https://www.postgresql.org/media/keys/ACCC4CF8.asc
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
@JarenGlover
JarenGlover / gist:6118a897c6198a07cfd8
Last active August 29, 2015 14:24
iptables CoreOS with rules for etcd
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 0 -j ACCEPT