Skip to content

Instantly share code, notes, and snippets.

Avatar
🤔

Duke dukex

🤔
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@dukex
dukex / cerbot.sh
Last active Jan 5, 2019
Docker cerbot
View cerbot.sh
docker run -it --rm \
-v /etc/letsencrypt:/etc/letsencrypt \
-v /var/lib/letsencrypt:/var/lib/letsencrypt \
-v /var/www/letsencrypt:/var/www/letsencrypt \
-v "/var/log/letsencrypt:/var/log/letsencrypt" \
certbot/certbot \
certonly --webroot \
--register-unsafely-without-email --agree-tos \
--webroot-path=/var/www/letsencrypt \
-d DOMAIN
View linearregression.rb
# Adapted from a C# example here:
# http://stackoverflow.com/questions/43224/how-do-i-calculate-a-trendline-for-a-graph
# And thanks to John Esser for helping figure out how to
# calculate the targets to stabilize a negative slope!
class LinearRegression
attr_accessor :slope, :intercept
# Pass in an array of values to get the regression on
@dukex
dukex / -etc-NetworkManager-NetworkManager.conf
Created Mar 11, 2018
.dev domain resolving to 127.0.0.1 [Arch]
View -etc-NetworkManager-NetworkManager.conf
# Configuration file for NetworkManager.
# See "man 5 NetworkManager.conf" for details.
[main]
dns=dnsmasq
View tagged_worker_tracer.rb
# frozen_string_literal: true
module MyApp
module TaggedWorkerTracer
extend ActiveSupport::Concern
attr_reader :metadata, :delivery_info,
:routing_key, :correlation_id, :customer_id,
:timestamp
View gist:41f5eaa100eefa8d2d6323210cebde29
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro -v /var/lib/docker:/var/lib/docker martin/docker-cleanup-volumes
@dukex
dukex / sketch.sh
Created Feb 13, 2017 — forked from jackbillstrom/sketch.sh
The magic timetraveler script for Sketch trial
View sketch.sh
#!/bin/sh
echo "Traveling back in time..."
date 0318125013
echo "Opening Sketch..."
open -a Sketch
echo "Traveling to present time..."
ntpdate -u time.apple.com
echo "Done..."
exit 0
View cordova-init.sh
#!/bin/bash
branch_name=$(git branch | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1/")
echo "Removing old cordova directory"
rm -rf cordova
echo "Creating cordova app to ${branch_name}..."
echo "WARNING: say 'no' to the next prompts"
ember generate cordova-init "my.company.${branch_name}" --platform=android
@dukex
dukex / 5.c
Last active Sep 7, 2015 — forked from anonymous/5.c
Avaliação 1
View 5.c
#include <stdio.h>
int main(int argc, char const *argv[]) {
int a, b, temp;
scanf("%d", &a);
scanf("%d", &b);
temp = a;
a = b;
b = temp;
printf("\n Agora a=%d e b=%d\n", a, b);
View admin.js
import Ember from 'ember';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
export default Ember.Route.extend(AuthenticatedRouteMixin, {
session: Ember.inject.service('session')
beforeModel() {
const userType = this.get('session.authenticated.type');
if(userType !== 'admin') {
this.tranistionTo('login')
}