Skip to content

Instantly share code, notes, and snippets.

View zackexplosion's full-sized avatar
🏠
Working from home

Zack zackexplosion

🏠
Working from home
View GitHub Profile
@AndiSHFR
AndiSHFR / CalculateUptimeSeconds.c
Created March 20, 2016 13:54
Calculate uptime in seconds on adruino from millis().
/**
* CalculateUptimeSeconds()
*
* Handle millis() rollover and calculate the total uptime in seconds.
* This function must be called at least once for every 50 days to be
* able to see the rollover.
*/
unsigned long CalculateUptimeSeconds(void) {
static unsigned int _rolloverCount = 0; // Number of 0xFFFFFFFF rollover we had in millis()
@xrstf
xrstf / letsencrypt.md
Last active April 18, 2023 05:01
Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

This document details how I setup LE on my server. Firstly, install the client as described on http://letsencrypt.readthedocs.org/en/latest/using.html and make sure you can execute it. I put it in /root/letsencrypt.

As it is not possible to change the ports used for the standalone authenticator and I already have a nginx running on port 80/443, I opted to use the webroot method for each of my domains (note that LE does not issue wildcard certificates by design, so you probably want to get a cert for www.example.com and example.com).

Configuration

For this, I placed config files into etc/letsencrypt/configs, named after <domain>.conf. The files are simple:

@gaboesquivel
gaboesquivel / gulp-webapp-heroku.js
Last active October 5, 2015 13:30
how to publish a site built with generator-gulp-webapp to heroku
// 1. change dist dir to dist/public in the gulpfile
// 2. update .gitignore file too, dist --> dist/public
// 3. create dist/server.js
var express = require('express')
var serveStatic = require('serve-static')
var compression = require('compression')
var port = process.env.PORT || 3000;
var domain = process.env.DOMAIN;
@zackexplosion
zackexplosion / Setting up Google Cloud Storage with CORS for Web Fonts.md
Last active September 16, 2015 02:44 — forked from mhulse/Setting up Google Cloud Storage with CORS for Web Fonts.md
Setting up CORS on Google Cloud Storage: An unofficial quick start guide to serving web fonts from Google's cloud. (I'm sure a lot of this info could be improved... Please leave comments if you have tips/improvements.)

Login:

Google Cloud Storage

You'll want to login using an official Google account (i.e. if this is for your company, use the comapany Gmail account vs. a personal one.)

When logging in, you might be prompted to verify the account; if so, enter your cell number to get a verification e-mail or phone call.

Once verified, you'll have to agree to the terms of service; do that, and click continue.

@awmichel
awmichel / README.md
Last active May 17, 2024 04:23
Docker Machine OSX Autostart

Docker Machine OSX Autostart

This is a simple launchd config that will start your default docker-machine on startup. You can customize the machine that is started by updating lines 11 and 16 with the correct machine name.

Install

  1. Copy the file com.docker.machine.default.plist below to ~/Library/LaunchAgents/com.docker.machine.default.plist.
  2. Run the following in a terminal: launchctl load ~/Library/LaunchAgents/com.docker.machine.default.plist
  3. Profit!
@Dr-Nikson
Dr-Nikson / README.md
Last active June 8, 2023 12:04
Auth example (react + redux + react-router)
@skplunkerin
skplunkerin / message.md
Last active December 6, 2023 05:02
rails custom error message validation without column

Best solution:

http://stackoverflow.com/a/808776/1180523

# model
validates   :email,    :uniqueness => { message: "is wrong" }
validates   :name,    :uniqueness => { message: "Your name is wrong" }

HUMANIZED_ATTRIBUTES = {
  :email => "E-mail address",
  :name => "" # don't include column name in error
@cirosantilli
cirosantilli / README.md
Last active July 3, 2018 12:23
Streak generator. 100 year streak: https://github.com/cirosantilli/test-streak
@johnbintz
johnbintz / simple-capistrano-docker-deploy.rb
Last active April 3, 2023 08:23
Simple Capistrano deploy for a Docker-managed app
# be sure to comment out the require 'capistrano/deploy' line in your Capfile!
# config valid only for Capistrano 3.1
lock '3.2.1'
set :application, 'my-cool-application'
# the base docker repo reference
set :name, "johns-stuff/#{fetch(:application)}"
@sogko
sogko / app.js
Last active November 8, 2022 12:31
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');