Skip to content

Instantly share code, notes, and snippets.

@koop
koop / ensure-cert-macos.sh
Created November 28, 2017 20:27
Ensures a certificate is in the macOS system keychain.
#!/bin/bash
# Usage
# $ ./install-cert-macos.sh "/path/to/cert"
CERT_PATH="$1"
# First, grab the SHA-1 from the provided SSL cert.
CERT_SHA1=$(openssl x509 -in "$CERT_PATH" -sha1 -noout -fingerprint | cut -d "=" -f2 | sed "s/://g")
# Next, grab the SHA-1s of any standard.dev certs in the keychain.
# Don't return an error code if nothing is found.
@connor11528
connor11528 / create_laravel_app.sh
Created July 11, 2017 21:09
Create a new Laravel application
#!/bin/bash
laravel new $1
cd $1
composer install
yarn install
touch README.md
cp .env.example .env
git init
git add -A
@slavapas
slavapas / Hide Div When Clicked Outside It
Created March 29, 2017 13:14
Hide Div When Clicked Outside It
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Vanilla Javascript DropDown Menu Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="menu-dropdown">Menu &#9660;</div>
@LeonardA-L
LeonardA-L / backtrack.js
Created February 21, 2017 05:23
Back-tracking through a grid
//NB: map = grid
// Map dimension
var N = 5;
// Map init
var map = [];
for(var i = 0; i<N; i++) {
map.push([])
for(var j=0;j<N; j++) {
map[i].push(
@AloofBuddha
AloofBuddha / associations.md
Last active February 27, 2024 08:25
Sequelize Relationships: hasOne vs belongsTo
@nrollr
nrollr / MySQL_macOS_Sierra.md
Last active January 31, 2024 14:45
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

@btfak
btfak / useHexo.md
Created May 26, 2016 09:41
How to use Hexo and deploy to GitHub Pages
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

import java.util.LinkedList;
import java.util.Queue;
public class LevelOrderTraversal {
public void levelOrderNaiveApproach(Node root){
int h = height(root);
for(int i=1;i<=h;i++){
printLevels(root,i);
System.out.println("");
@vasanthk
vasanthk / System Design.md
Last active May 31, 2024 01:39
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?