Skip to content

Instantly share code, notes, and snippets.

View tobybot11's full-sized avatar
🎯
Focusing

Tobias Ford tobybot11

🎯
Focusing
View GitHub Profile
@dnordby
dnordby / rails-background-workers-with-resque.md
Last active December 20, 2017 15:52
Set up background workers on Heroku with Reqsque/Redis

Set Up Background Workers with Resque/Redis on Heroku

LOCAL SETUP

Ensure Redis is installed on local machine

To install, run (assumes HomeBrew is already set up):
$ brew install redis

Start Redis server
$ redis-server

@jqtrde
jqtrde / cleaned.csv
Last active July 29, 2018 01:28
A (shitty) way to transform a list of coordinates in UTM to Long/Lat, using gdaltransform.
longitude latitude
-67.5667647785632 44.9266200808726
-67.5743171887273 44.9225196819941
-67.4990497512917 44.9318714003755
-67.5030556021784 44.9347506234824
-67.5786140266091 44.9183512942229
-67.6303354677011 44.9853731325686
-67.5162499184765 44.9661867740563
-67.5100731884277 44.9701572281092
-68.069497177844 44.8405511153813
@danvk
danvk / index.html
Created April 4, 2018 16:47
Demonstration of polygon outlines in Mapbox GL JS
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Update a choropleth layer by zoom level</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.44.1/mapbox-gl.js'></script>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://d3js.org/topojson.v2.min.js"></script>
@mikermcneil
mikermcneil / sails-policy-best-practices-and-faq.md
Last active July 11, 2019 09:48
FAQ and best practices for using policies in Sails.js

Policies in Sails.js

Policies are additive. Anything you might do with policies, you could just implement in your custom actions directly. But they can make your life a lot easier.

When should I use policies?

Policies can be used like middleware, meaning you can do almost anything you can imagine with them. That said, our experience using Sails to build all sorts of different apps has taught us that policies are best used for one, very specific purpose: preventing access to actions for certain users (or types of users) where those actions are not accessible in the UI. That is, policies are best used like preconditions-- you can use them to take care of edge cases that are only possible by cheating the UI.

For example, imagine you're building an action called changePassword in your UserController. Its job is to take the new password that was provided, encrypt it, then update the database record for the currently-logged-in user to save the new encryped password. When you implement and test

@JJediny
JJediny / RHEL6STIGtoNIST800.csv
Created January 11, 2017 16:26
RHEL6 STIG w/ NIST 800-53 Controls - Example output from https://github.com/opencontrol/xccdf2csv
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 2.
STIG ID,Version,Rule Title,Title,Severity,Check Text,Fix Text,CCI,CCI,Status,Published,contributor,Definition,Type,NIST800-53rev4,Control,NIST800-53rev3,Control,NIST800-53rev1,Control
38437,RHEL-06-000526,Automated file system mounting tools must not be enabled unless needed.,SRG-OS-999999,low,"To verify the ""autofs"" service is disabled, run the following command:
chkconfig --list autofs
If properly configured, the output should be the following:
autofs 0:off 1:off 2:off 3:off 4:off 5:off 6:off
Verify the ""autofs"" service is not running:

Meltdown fix impact on Redis performances in virtualized environments

UPDATE: apparently kernel difference may have a serious impact, so I'll redo the test from scratch.

Test performed with AOF enabled, fsync policy 1 second, allowing the rewrites to be triggered.

Command lines used:

@amitmerchant1990
amitmerchant1990 / stylish.css
Last active March 26, 2021 02:21
Revert back to good old GitHub Homepage
/**
1. Install the Stylish(https://chrome.google.com/webstore/detail/stylish/fjnbnpbmkenffdnngjfgmeleoegfcffe?hl=en) extension for Chrome.
2. Open up extension options and paste the CSS mentioned below.
3. Specify the "URLs on the domain" to be `github.com`.
4. Add a title and save.
*/
.dashboard-sidebar {
float: right;
padding-right: 10px;
@gambtho
gambtho / gist:36a2f01e9e7d8c1b0046fb074f1a44ee
Last active August 25, 2021 12:45
Zookeeper.service systemd script for zookeeper
from - http://davidssysadminnotes.blogspot.com/2016/01/installing-apache-kafka-and-zookeeper.html
[smack1]# vi /etc/systemd/system/kafka-zookeeper.service
[Unit]
Description=Apache Zookeeper server (Kafka)
Documentation=http://zookeeper.apache.org
Requires=network.target remote-fs.target
After=network.target remote-fs.target
[Service]
Type=simple
@natemartinsf
natemartinsf / LinkButton.js
Created November 27, 2016 05:48
Wrapped @blueprintjs Button to work with React-Router
import React, {Component} from 'react';
import { Button } from '@blueprintjs/core';
import withRouter from 'react-router/lib/withRouter';
let typeOf = (o) => toString.call(o).slice(8, -1).toLowerCase();
function createLocationDescriptor({to, query, hash, state}) {
if (typeOf(to) === 'string') {
return {pathname: to, query, hash, state};
}
@boxdot
boxdot / async.rs
Last active November 9, 2022 12:03
Async stdin reading with thread and futures in Rust
extern crate futures;
use std::io::{self, BufRead};
use std::thread;
use futures::{Future, Sink, Stream};
use futures::stream::BoxStream;
use futures::sync::mpsc::channel;
fn stdin() -> impl Stream<String, io::Error> {