Skip to content

Instantly share code, notes, and snippets.

@agbaraka
agbaraka / creative-cloud-disable.md
Created May 19, 2017 07:00 — forked from andreibosco/creative-cloud-disable.md
disable creative cloud startup on mac
@agbaraka
agbaraka / cliserver.php
Created July 7, 2017 08:26 — forked from ckressibucher/cliserver.php
Router script for PHP built in server
<?php
// public/cliserver.php (router script)
if (php_sapi_name() !== 'cli-server') {
die('this is only for the php development server');
}
if (is_file($_SERVER['DOCUMENT_ROOT'].'/'.$_SERVER['SCRIPT_NAME'])) {
// probably a static file...
return false;
@agbaraka
agbaraka / app.yaml
Created August 18, 2017 06:49 — forked from darktable/app.yaml
GAE: App.yaml designed for serving a static site on Google App Engine (Python). Copy your static html and files into a folder called "static" next to app.yaml. Contains a bunch of mimetype declarations from html5boilerplate's .htaccess. May not be neces
application: you-app-name-here
version: 1
runtime: python
api_version: 1
default_expiration: "30d"
handlers:
- url: /(.*\.(appcache|manifest))
mime_type: text/cache-manifest
package main
import "fmt"
func binarySearch(needle int, haystack []int) bool {
low := 0
high := len(haystack) - 1
@agbaraka
agbaraka / parse_json_post.go
Last active March 3, 2018 13:32 — forked from andreagrandi/parse_json_post.go
Parse a JSON http POST in GoLang
package main
import (
"encoding/json"
"fmt"
"net/http"
)
type test_struct struct {
Test string
@agbaraka
agbaraka / .bashrc
Last active March 20, 2018 08:13
Adding Docker Compose in CoreOS using Docker
function docker-compose() {
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v "$PWD:/rootfs/$PWD" -w="/rootfs/$PWD" docker/compose:1.16.1 "$@"
}
#export docker-compose() to make it available in bash shell and scripts
export -f docker-compose
[^\x00-\x7F]
*
@agbaraka
agbaraka / caddy2_reverse_proxy.json
Last active July 9, 2023 08:04
Caddy server v2: reverse proxy config json for multiple virtual hosts
{
"apps": {
"http": {
"servers": {
"example": {
"listen": ["127.0.0.1:80"],
"routes": [
{
"match":[{"host":["a.myhost.com"]}],
"handle": [
@agbaraka
agbaraka / bash.sh
Created August 20, 2019 05:29
Recursively delete all node_modules folder found in projects folder
find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
@agbaraka
agbaraka / docker_remote.go
Created September 14, 2019 08:21
Access remote docker daemon via ssh using Golang Docker SDK
package main
import (
"context"
"fmt"
"github.com/docker/cli/cli/connhelper"
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"net/http"
"os"