Skip to content

Instantly share code, notes, and snippets.

View chrisenytc's full-sized avatar
👨‍💻

Christopher Enytc chrisenytc

👨‍💻
View GitHub Profile
@chrisenytc
chrisenytc / aws-metadata.sh
Created July 22, 2018 05:43
Creating wildcard ssl with certbot on AWS
#!/bin/bash
set -e
# Set environment variables
export AWS_IAM_ROLE=$(curl "http://169.254.169.254/latest/meta-data/iam/security-credentials/" 2>/dev/null)
if [ "${AWS_IAM_ROLE}" ]; then
export AWS_ACCESS_KEY_ID=$(curl "http://169.254.169.254/latest/meta-data/iam/security-credentials/${AWS_IAM_ROLE}" 2>/dev/null | jq -r .AccessKeyId)
export AWS_SECRET_ACCESS_KEY=$(curl "http://169.254.169.254/latest/meta-data/iam/security-credentials/${AWS_IAM_ROLE}" 2>/dev/null | jq -r .SecretAccessKey)
Verifying my Blockstack ID is secured with the address 1KesnsUus9SRg8iZjiacZQmNhDFPqH1Ucv https://explorer.blockstack.org/address/1KesnsUus9SRg8iZjiacZQmNhDFPqH1Ucv

Keybase proof

I hereby claim:

  • I am chrisenytc on github.
  • I am chrisenytc (https://keybase.io/chrisenytc) on keybase.
  • I have a public key whose fingerprint is B0FE E99B DCA5 BE22 FEEC 3CB6 EA34 F201 1784 EEF3

To claim this, I am signing this object:

@chrisenytc
chrisenytc / privacy
Created July 1, 2016 06:48
Flórida Restaurante e Café Terms of Service and Privacy Policy
Flórida Restaurante e Café Terms of Service and Privacy Policy
1. Terms
By accessing the website at http://restauranteflorida.com.br, you are agreeing to be bound by these terms of service, all applicable laws and regulations, and agree that you are responsible for compliance with any applicable local laws. If you do not agree with any of these terms, you are prohibited from using or accessing this site. The materials contained in this website are protected by applicable copyright and trademark law.
2. Use License
Permission is granted to temporarily download one copy of the materials (information or software) on Flórida Restaurante e Café's website for personal, non-commercial transitory viewing only. This is the grant of a license, not a transfer of title, and under this license you may not:
modify or copy the materials;
@chrisenytc
chrisenytc / directives.js
Created October 3, 2014 13:15
Add class active to a menu with AngularJS directive
'use strict';
angular.module('App').directive('isActive', ['$location', function($location) {
return {
restrict: 'A',
link: function(scope, element) {
scope.location = $location;
scope.$watch('location.path()', function(currentPath) {
var formatedPath = '';
if(currentPath === '/') {
@chrisenytc
chrisenytc / client.js
Created September 15, 2014 03:03
Socket.io 1.0.x Authentication example
'use strict';
var socket = io.connect('http://localhost:3000', { query: 'token=12345'});
@chrisenytc
chrisenytc / install.sh
Created August 11, 2014 21:10
How to install Comodo Positive SSL on AWS ELB
cat yourdomain_com.crt COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt >> ssl-bundle.crt
function parseAge(dateString) {
function parse(date) {
date = date || '00/00/0000';
var dateStorage = date.split('/');
return dateStorage[1].replace(/^0/, '') + '/' + dateStorage[0] + '/' + dateStorage[2];
}
var today = new Date();
var birthDate = new Date(parse(dateString));
var age = today.getFullYear() - birthDate.getFullYear();
var m = today.getMonth() - birthDate.getMonth();
@chrisenytc
chrisenytc / swig.js
Last active September 3, 2016 02:12
Example of use swig template engine
var App = require('express')(),
swig = require('swig');
//Swig
swig.setDefaults({
cache: 'memory'
});
//assign the template engine to .html files
App.engine('html', swig.renderFile);

Regular Expressions

Basic Syntax

  • /.../: Start and end regex delimiters
  • |: Alternation
  • (): Grouping