Skip to content

Instantly share code, notes, and snippets.

@sher
sher / readme.md
Created May 24, 2017 03:36
Self-signed SSL cert on macOS
$ cat > openssl.cnf <<-EOF
[req]
distinguished_name = req_distinguished_name
x509_extensions = v3_ca
prompt = no
[req_distinguished_name]
CN = example.local
[v3_ca]
keyUsage = digitalSignature, keyEncipherment
@sher
sher / install-erlang-elixir.sh
Created December 29, 2016 04:18
Install erlang and elixir on CentOS 7
yum update
yum install epel-release
yum install gcc gcc-c++ glibc-devel make ncurses-devel openssl-devel autoconf java-1.8.0-openjdk-devel git wget wxBase.x86_64
wget https://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
rpm -Uvh erlang-solutions-1.0-1.noarch.rpm
yum update
yum install erlang
cd /usr/local/lib
git clone https://github.com/elixir-lang/elixir.git
cd elixir
@sher
sher / localhost.ini
Last active October 28, 2016 04:45
Sample Ansible playbook for Vultr servers
[localhost]
127.0.0.1 ansible_connection=local ansible_python_interpreter=python
1: 日
2: 一
3: 国
4: 会
5: 人
6: 年
7: 大
8: 十
9: 二
10: 本
@sher
sher / gist:23ed544e29804ad24a11
Created June 27, 2015 04:06
Styled React component mixin with reference counting
function _mount(style, styles) {
for (var i = 0; i < styles.length; i++) {
if (style == styles[i].getAttribute('href')) {
styles[i].dataset.refc++;
return;
}
}
var newStyle = document.createElement('link');
newStyle.setAttribute('rel', 'stylesheet');
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js"></script>
<meta name="description" content="Something" />
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body ng-app="app" ng-controller="AppCtrl">
#!/bin/bash
# CentOS rbenv system wide installation script
# Forked from https://gist.github.com/1237417
# Installs rbenv system wide on CentOS 5/6, also allows single user installs.
# Install pre-requirements
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel \
make bzip2 autoconf automake libtool bison iconv-devel git-core
module DatatablesRails
class Structify
attr_accessor :struct
def initialize(data)
@struct = {}
@struct = data.collect{|d| d.attributes }
end
def formatter(&block)
#block.call(@struct)
@sher
sher / nginx
Created August 20, 2011 01:29
nginx init.d script
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemin
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid