Skip to content

Instantly share code, notes, and snippets.

View dennis-tra's full-sized avatar
🇺🇦

Dennis Trautwein dennis-tra

🇺🇦
View GitHub Profile
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@cobyism
cobyism / gh-pages-deploy.md
Last active July 18, 2024 05:22
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@mark-adams
mark-adams / lift_json.rb
Created November 30, 2015 05:12
A handy fluentd filter for lifting out nested json log messages from Docker logs.
module Fluent
class LiftJsonFilter < Filter
Fluent::Plugin.register_filter('lift_json', self)
def filter(tag, time, record)
begin
record = record.merge JSON.parse(record['log'])
record.delete 'log'
rescue Exception
end
@pstehlik
pstehlik / ipfs_install.sh
Created February 4, 2018 22:36
Install IPFS on Ubuntu 16.04 64bit and set up as systemd service
#!/bin/bash
#pick your IPFS version
VERS=0.4.13
DIST="go-ipfs_v${VERS}_linux-amd64.tar.gz"
sudo apt-get update
sudo apt-get install golang-go -y
wget https://dist.ipfs.io/go-ipfs/v0.4.13/$DIST
tar xvfz $DIST

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@wootfish
wootfish / beta_test.py
Last active April 9, 2022 11:51
Test scripts for DHT size estimation
# this script samples the distributions of the k closest peers to randomly
# selected addresses and saves these to data files
import datetime
from multiprocessing import Process, Event
import os
import pprint
import random
@schacon
schacon / better-git-branch.sh
Created January 13, 2024 18:41
Better Git Branch output
#!/bin/bash
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
NO_COLOR='\033[0m'
BLUE='\033[0;34m'
YELLOW='\033[0;33m'
NO_COLOR='\033[0m'