Skip to content

Instantly share code, notes, and snippets.

@raecoo
raecoo / treemap_header_02.html
Created September 9, 2020 14:38 — forked from billdwhite/treemap_header_02.html
d3 Treemap with Headers Demo
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Treemap - Neat Zoom Effect</title>
<script type="text/javascript" src="./d3/d3.js"></script>
<style type="text/css">
body {
overflow: hidden;
margin: 0;
@raecoo
raecoo / .block
Created September 3, 2020 00:56 — forked from mbostock/.block
Nested Treemap
license: gpl-3.0
height: 1060
redirect: https://observablehq.com/@d3/nested-treemap
@raecoo
raecoo / sidekiq.service
Created November 23, 2019 14:00 — forked from brycejohnston/sidekiq.service
Sidekiq systemd service for Debian
#
# systemd unit file for Debian
#
# Put this in /lib/systemd/system
# Run:
# - systemctl enable sidekiq
# - systemctl {start,stop,restart} sidekiq
#
# This file corresponds to a single Sidekiq process. Add multiple copies
# to run multiple processes (sidekiq-1, sidekiq-2, etc).
@raecoo
raecoo / String.toRegExp.js
Created October 15, 2019 06:34 — forked from BrandonZacharie/String.toRegExp.js
A JavaScript function to convert a string to a RegExp
if (!String.toRegExp)
String.toRegExp = function String_toRegExp(pattern, flags) {
return new RegExp(pattern.replace(/[\[\]\\{}()+*?.$^|]/g, function (match) { return '\\' + match; }), flags);
};
@raecoo
raecoo / pubsub.go
Created October 13, 2019 14:05 — forked from miguelmota/pubsub.go
Golang redis pub/sub example
package pubsub
import (
"github.com/garyburd/redigo/redis"
log "github.com/sirupsen/logrus"
)
// Service service
type Service struct {
pool *redis.Pool
"""
Copy objects from one bucket/prefix to another bucket with the same prefix.
Used to allow CloudFront logs to get parsed for uploading to ES *AND* analyzed
by WAF.
CloudFront Distribution logs -> s3://es-bucket/incoming -> Lambda (this) -> s3://waf-bucket/
Set environment variable `destination_bucket`
@raecoo
raecoo / jekyll-guide.md
Created July 28, 2019 09:44 — forked from hellokaton/jekyll-guide.md
Jekyll 中的配置和模板语法

Jekyll 中的配置和模板语法

配置

文件介绍

_config.yml

Jekyll 的全局配置文件。
比如网站的名字,网站的域名,网站的链接格式等等。

@raecoo
raecoo / deploy.rb
Created June 14, 2019 06:01 — forked from Epigene/deploy.rb
Mina deployment file for rails applications
# Mina Deploy
# ===========
#
# Adapted from Creative deploy stack in Manabalss v4, Mar.2015, updated to support staging on Jun.2015
# On first deploy do: mina setup --verbose
# Then do : mina deploy[initialize] --trace
#
# Usage examples:
# mina deploy[soft,seed,compile] to=staging # deploy task with all options | a simple `mina deploy` will deploy to production
# mina rake[db:seed] # for multi-argument tasks # mina 'rake[payments:refund[arg1\,arg2]]'
@raecoo
raecoo / sha256.scala.md
Created June 13, 2019 05:46 — forked from navicore/sha256.scala.md
sha256 single line function in scala

def sha256Hash(text: String) : String = java.security.MessageDigest.getInstance("SHA-256").digest(text.getBytes()).map(0xFF & ).map { "%02x".format() }.foldLeft(""){_ + _}

def sha256Hash(text: String) : String = String.format("%064x", new java.math.BigInteger(1, java.security.MessageDigest.getInstance("SHA-256").digest(text.getBytes("UTF-8"))))

verify via:

scala&gt; sha256Hash("Rusty is a cowboy!")
@raecoo
raecoo / Backup MySQL to Amazon S3.md
Last active February 10, 2019 08:23 — forked from oodavid/README.md
Backup MySQL to Amazon S3

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc