Skip to content

Instantly share code, notes, and snippets.

View dstroot's full-sized avatar
:octocat:
Slingin' Code

Dan Stroot dstroot

:octocat:
Slingin' Code
View GitHub Profile
@dstroot
dstroot / install_reboot.sh
Created May 23, 2012 21:03
install forever reboot script
#!/bin/bash
echo "*****************************************"
echo " Download the script and add to crontab "
echo "*****************************************"
sudo wget https://raw.github.com/gist/2777778/e92dc28e3f3961e0e2740d262b3ed884a11f6f85/reboot.sh
sudo chmod 777 reboot.sh
sudo line="@reboot ~/reboot.sh >> cron.log 2>&1"
sudo (crontab -l; echo "$line" ) | crontab -
sudo checkconfg crond on
@dstroot
dstroot / app.js
Created July 13, 2014 16:29
Gulp, BrowserSync, Node, and Nodemon all working in harmony. ;)
/**
* World's simplest express server
* - used to serve index.html from /public
*/
var express = require('express');
var serveStatic = require('serve-static');
var app = express();
app.use(serveStatic(__dirname + '/public'));
@dstroot
dstroot / handlers.go
Last active April 10, 2023 13:22 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"io"
"net/http"
"sync/atomic"
)
func index() http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@dstroot
dstroot / github-ubuntu.sh
Last active September 20, 2022 08:23
Setting up github on Ubuntu
#!/bin/bash
###############################################
# To use:
# wget https://raw.github.com/gist/4411254
# chmod 777 github-ubuntu.sh
# ./github-ubuntu.sh
###############################################
echo "*****************************************"
echo " Step 1: Check your keys"
echo "*****************************************"

Using an Access Token for the first time

Follow the instructions on Github to Create an Access Token in Github

Configure Git to use the osxkeychain

By default, git credentials are not cached so you need to tell Git if you want to avoid having to provide them each time Github requires you to authenticate. On Mac, Git comes with an “osxkeychain” mode, which caches credentials in the secure keychain that’s attached to your system account.

You can tell Git you want to store credentials in the osxkeychain by running the following:-

@dstroot
dstroot / performance.txt
Created May 25, 2012 01:27
Performance Tuning your TCP Stack
#!/bin/bash
echo "*****************************************"
echo " Based on information from Google"
echo " http://dev.chromium.org/spdy/spdy-best-practices"
echo "*****************************************"
sudo su
yum –y update
echo "*****************************************"
echo " Changing initcwnd and initrwnd"
echo " Step 1: check route settings."
@dstroot
dstroot / install_postgresql.sh
Created June 13, 2012 00:26
Install PostgreSQL on Amazon AMI
#!/bin/bash
###############################################
# To use:
# https://raw.github.com/gist/2776351/???
# chmod 777 install_postgresql.sh
# ./install_postgresql.sh
###############################################
echo "*****************************************"
echo " Installing PostgreSQL"
echo "*****************************************"
@dstroot
dstroot / useIntersectionObserver.js
Created November 6, 2021 00:51
The Intersection Observer API allows you to configure a callback that is called whenever an element intersects either the device viewport.
import { useEffect } from 'react';
const useIntersectionObserver = ({
target,
onIntersect, // callback
threshold = 0.2, // when 20% visible
rootMargin = "0px", // don't adjust viewport margin
}) => {
useEffect(() => {
@dstroot
dstroot / install-redis.sh
Created May 23, 2012 17:56
Install Redis on Amazon EC2 AMI
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://raw.github.com/gist/2776679/04ca3bbb9f085b192f6aca945120fe12d59f15f9/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"
@dstroot
dstroot / ec2-mysql-installation.sh
Created May 23, 2012 16:55
Install mysql on amazon EC2 AMI
#!/bin/bash
###############################################
# To use:
# https://raw.github.com/gist/2776351/5fc6f3a63450ff6986ac916fce54d70c16937646/ec2-mysql-installation.sh
# chmod 777 install-redis.sh# ./install-redis.sh
###############################################
echo "*****************************************"
echo " Installing MySQL"
echo "*****************************************"
echo " "