Skip to content

Instantly share code, notes, and snippets.

View skanjo's full-sized avatar

Samer Kanjo skanjo

View GitHub Profile
@skanjo
skanjo / update-adblock-dnsmasq.sh
Created June 21, 2017 16:21 — forked from jac18281828/filter_unicode.py
Ad Blocking script for dnsmasq. This uses Steven Black's Ad Blocking /etc/hosts file but converts it to dnsmasq format. This could be used with either the AdBlocking Raspberry PI project or on a Unify EdgeRouter
#!/bin/bash
ad_hosts_url="https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"
# The IP address below should point to the IP where blocked traffic should go
# or to a non routable address such as 0.0.0.0
# OpenDNS block page
# pixelserv_ip="146.112.61.104"
# not routable address
@skanjo
skanjo / gist:9ac74aa59c838424b47ffd1facd8c0fe
Created October 22, 2017 00:28 — forked from InfoSec812/gist:a45eb3b7ba9d4b2a9b94
SSL Config Example For Vert.x 3.0.0
package com.zanclus.socialshell;
import com.zanclus.socialshell.utils.AbstractLoggingVerticle;
import static io.vertx.ext.auth.shiro.LDAPAuthRealmConstants.*;
import io.vertx.core.AsyncResult;
import io.vertx.core.Future;
import io.vertx.core.Verticle;
import io.vertx.core.http.HttpServerOptions;
import io.vertx.core.json.JsonObject;
@skanjo
skanjo / brew-java-and-jenv.md
Created May 2, 2018 20:49 — forked from tomysmile/brew-java-and-jenv.md
How To Install Java 8 on Mac

Install HomeBrew first

brew update
brew tap caskroom/cask
brew install brew-cask

If you get the error "already installed", follow the instructions to unlink it, then install again:

@skanjo
skanjo / jwt.cljs
Created July 9, 2018 15:09 — forked from aputs/jwt.cljs
clojurescript JWT encode/decode (SHA version only)
(ns cljsjs.jwt
(:require
[clojure.spec :as s]
[clojure.string :as str]
[goog.json :as json]
[goog.crypt.base64 :refer [encodeString decodeString]]))
;; https://github.com/Caligatio/jsSHA
;; goog.crypt.hmac produces different signature than nodejs version
(def jssha (js/require "jssha"))
@skanjo
skanjo / nix-cheat.sh
Created July 20, 2018 02:41 — forked from aaronsaunders/nix-cheat.sh
Quick reference for nix command line commands that I can never remember...
# Unix shell
# run if zero exit
cd tmp/a/b/c && tar xvf ~/archive.tar # untar if dir exists
# run if non-zero exit
cd tmp/a/b/c || mkdir -p tmp/a/b/c
cd tmp/a/b/c || mkdir -p tmp/a/b/c && tar xvf -C tmp/a/b/c ~/archive.tar
which
whereis
@skanjo
skanjo / README-Template.md
Created July 20, 2018 15:38 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@skanjo
skanjo / RDS-Aurora-CloudFormation-Example.yaml
Created July 26, 2018 19:59 — forked from sjparkinson/RDS-Aurora-CloudFormation-Example.yaml
A basic CloudFormation template for an RDS Aurora cluster.
---
AWSTemplateFormatVersion: 2010-09-09
Description: >
A basic CloudFormation template for an RDS Aurora cluster.
Parameters:
DatabaseUsername:
AllowedPattern: "[a-zA-Z0-9]+"
ConstraintDescription: must be between 1 to 16 alphanumeric characters.

Caches all the way down

https://ldnwebperf.org/events/caches-all-the-way-down/

Layers of caching in the browser

(kind of Chromium specific here and there)

1. MemoryCache

  • same rendering process, short-lived
  • strict matching, same resource type, etc, CSP
  • everything (even no-cache, except for no-store)
@skanjo
skanjo / promises-passing-values.cljs
Created August 30, 2018 14:49 — forked from pesterhazy/promises-passing-values.cljs
Promise chains in ClojureScript and the problem of previous values
(ns my.promises
"Demo to show different approaches to handling promise chains in ClojureScript
In particular, this file investigates how to pass data between Promise
callbacks in a chain.
See Axel Rauschmayer's post
http://2ality.com/2017/08/promise-callback-data-flow.html for a problem
statement.