This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime, timedelta | |
from airflow.models import Variable | |
from airflow import DAG | |
from airflow.operators.bash_operator import BashOperator | |
private_key = Variable.get("git_deploy_private_key_secret") | |
repo_url = Variable.get("git_remote_url") | |
default_args = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'logger' | |
module Dim | |
class Logger < ::Logger | |
def initialize(*) | |
super | |
@formatter = NoTimestampFormatter.new | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%# Put this code snippet between the <head></head>-tags in your application layout and %> | |
<%# replace 'UA-XXXXXXXX-X' with your own unique Google Analytics Tracking ID %> | |
<%# ... %> | |
<head> | |
<%# ... %> | |
<% if Rails.env.production? %> | |
<script type="text/javascript"> | |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var firmata = require('firmata'); | |
var repl = require('repl'); | |
var board = new firmata.Board('/dev/ttyAMA0',function(err){ | |
//arduino is ready to communicate | |
if (err) { | |
console.log("err:" + err); | |
return; | |
} | |
console.log("Firmata Firing LEDs"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mkdir -p ~/.ssh | |
# generate new personal ed25519 ssh keys | |
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "rob thijssen <rthijssen@gmail.com>" | |
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_robtn -C "rob thijssen <rob@rob.tn>" | |
# generate new host cert authority (host_ca) ed25519 ssh key | |
# used for signing host keys and creating host certs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SingaporeLicensePlateValidator < ActiveModel::EachValidator | |
def validate_each(record, attribute, value) | |
record.errors[attribute] << (options[:message] || "is not valid") unless valid_format?(value) | |
end | |
def valid_format?(license_plate) | |
prefix, numbers, suffix = license_plate.to_s.upcase.gsub(/\W+/, '').scan(/^\s*([A-Z]{1,3})(\d{1,4})(.+)$/).flatten | |
license_plate = ('%3s' % prefix.to_s) + ('%4d' % numbers.to_i) + suffix.to_s | |
zero = ('A'.ord-1).chr | |
numbers = [] | |
license_plate.each_char {|char| numbers.push((num = char.ord - zero.ord) > 0 ? num : char)} |