Skip to content

Instantly share code, notes, and snippets.

View bmcculley's full-sized avatar

bmcculley

View GitHub Profile
@bmcculley
bmcculley / webserver.go
Created January 9, 2023 20:42 — forked from alexisrobert/webserver.go
Tiny web server in Go for sharing a folder
/* Tiny web server in Golang for sharing a folder
Copyright (c) 2010 Alexis ROBERT <alexis.robert@gmail.com>
Contains some code from Golang's http.ServeFile method, and
uses lighttpd's directory listing HTML template. */
package main
import (
"compress/gzip"
@bmcculley
bmcculley / how-to-copy-aws-rds-to-local.md
Last active May 22, 2019 11:35 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
@bmcculley
bmcculley / README.md
Created April 27, 2018 05:42 — forked from pbojinov/README.md
Two way iframe communication- Check out working example here: http://pbojinov.github.io/iframe-communication/

Two way iframe communication

The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.

Parent

Send messages to iframe using iframeEl.contentWindow.postMessage Recieve messages using window.addEventListener('message')

iframe

@bmcculley
bmcculley / .Xresources
Created March 21, 2018 18:12 — forked from vreon/.Xresources
molokai color theme for xterm
! Molokai theme
*xterm*background: #101010
*xterm*foreground: #d0d0d0
*xterm*cursorColor: #d0d0d0
*xterm*color0: #101010
*xterm*color1: #960050
*xterm*color2: #66aa11
*xterm*color3: #c47f2c
*xterm*color4: #30309b
*xterm*color5: #7e40a5
@bmcculley
bmcculley / ajaxListener.js
Last active March 8, 2018 19:02 — forked from icodejs/ajaxListener.js
JS: Listen to ajax calls from Javascript
// https://stackoverflow.com/a/6036392/383904
var open = window.XMLHttpRequest.prototype.open,
send = window.XMLHttpRequest.prototype.send,
onReadyStateChange;
function openReplacement(method, url, async, user, password) {
var syncMode = async !== false ? 'async' : 'sync';
console.warn(
'Preparing ' +
syncMode +
@bmcculley
bmcculley / python_stop_thread.py
Created March 8, 2018 04:45 — forked from samarthbhargav/python_stop_thread.py
A 'stoppable' thread for Python
# source: https://www.safaribooksonline.com/library/view/python-cookbook-2nd/0596007973/ch09s03.html
import threading
class TestThread(threading.Thread):
def _ _init_ _(self, name='TestThread'):
""" constructor, setting initial variables """
self._stopevent = threading.Event( )
self._sleepperiod = 1.0
threading.Thread._ _init_ _(self, name=name)
def run(self):
@bmcculley
bmcculley / gist:f70bfbd96e2c0c9e2f38de61b2c5d03b
Created February 22, 2018 03:13 — forked from stran12/gist:1394757
Step-by-step installation of cGit with Nginx

How to install cGit on Nginx (Ubuntu server)

Step-by-step installtion of cGit on nginx without funky rewrite rules.

Pre-requisites

This is for :

@bmcculley
bmcculley / nginx-gitweb.md
Created February 22, 2018 02:11 — forked from mcxiaoke/nginx-gitweb.md
Set up Gitweb + Nginx from scratch on Debian Wheezy

This guide offers the least time-consuming way of setting up Nginx for serving Git repositories over HTTP using Gitweb. The stuff here has been tested with Git 1.9.1 and Nginx 1.6.0 on Debian Wheezy. Probably also works for Ubuntu, etc.

Total time ~ 10 minutes.

Install

Enable wheezy-backports by adding this line to /etc/apt/sources.list:

deb http://http.debian.net/debian wheezy-backports main
@bmcculley
bmcculley / balloontip.py
Created February 13, 2018 18:35 — forked from wontoncc/balloontip.py
Balloon tip module, Python, using win32gui.
# -- coding: utf-8 --
from win32api import *
from win32gui import *
import win32con
import sys, os
import struct
import time
class WindowsBalloonTip:
@bmcculley
bmcculley / index.html
Created January 19, 2018 19:01 — forked from johan/index.html
HTML5 GPS tracker
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>HTML5 GPS</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="style.css">
</head>