Skip to content

Instantly share code, notes, and snippets.

View alapini's full-sized avatar
🎯

Luc Alapini alapini

🎯
View GitHub Profile
@alapini
alapini / multi-language-schema.graphql
Created October 8, 2017 14:25
Using the schema to encode multi-language support into a GraphQL API.
type Video implements Node {
id: ID!
translations: VideoMetadataConnection
createdAt: DateTime!
modifiedAt: DateTime!
}
type VideoMetadata implements Node {
id: ID!
title: String!
@alapini
alapini / letsencrypt_2017.md
Created September 26, 2017 23:14 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

@alapini
alapini / zimbra-letsencrypt-renew.md
Created September 26, 2017 08:14 — forked from ugurerkan/zimbra-letsencrypt-renew.md
Zimbra 8.6.0 Letsencrypt SSL renew walkthrough.
@alapini
alapini / drawString.js
Created September 13, 2017 13:24 — forked from chriskoch/drawString.js
draw a multiline string in a html5 canvas element including rotation font fontsize and color
/*
* draw a multiline string rotated in a canvas
*
* @param ctx (M) context of the canvas
* @param text (M) string may contain \n
* @param posX (M) horizontal start position
* @param posY (M) vertical start position
* @param textColor color
* @param rotation in degrees (by 360)
* @param font must be installed on client use websafe
sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev -y
sudo apt-get install libfreetype6 libfreetype6-dev -y
sudo apt-get install libfontconfig1 libfontconfig1-dev -y
cd ~
export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"
wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/$PHANTOM_JS.tar.bz2
sudo tar xvjf $PHANTOM_JS.tar.bz2
sudo mv $PHANTOM_JS /usr/local/share
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin
@alapini
alapini / phantom-footer.js
Created August 24, 2017 09:57
Phantom js print header and footer
@alapini
alapini / slicemap_test.go
Created August 24, 2017 07:53 — forked from grahamking/slicemap_test.go
Benchmark comparing map access vs slice search
package main
import (
"math/rand"
"testing"
"time"
)
const (
numItems = 100 // change this to see how number of items affects speed
@alapini
alapini / main.go
Created August 22, 2017 19:54 — forked from jinzhu/main.go
handle postgres json with gorm
package main
import (
"fmt"
"github.com/jinzhu/gorm"
_ "github.com/lib/pq"
)
func main() {
@alapini
alapini / twitterbot.md
Created August 18, 2017 15:32 — forked from aparrish/twitterbot.md
Make-A-Twitter-Bot Workshop
@alapini
alapini / index.ios.js
Created August 3, 2017 12:19 — forked from Jpoliachik/index.ios.js
ReactNative LayoutAnimation Example
'use strict';
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View,
TouchableOpacity,
LayoutAnimation,
} from 'react-native';