Skip to content

Instantly share code, notes, and snippets.

View x1ddos's full-sized avatar

alex x1ddos

View GitHub Profile
@mentat
mentat / generate_protorpc.py
Created November 10, 2011 16:04
Generate Protocol Buffer definition file from Python ProtoRPC Module
"""
Thanks to [email protected] (Rafe Kaplan) for this tip.
Create a .proto file from a module containing ProtoRPC Message
classes.
"""
import logging
from protorpc import descriptor
from protorpc import generate
@jlord
jlord / index.html
Created April 19, 2012 06:39
Geocoder with Leaflet
<html>
<head>
<title>I'm learning</title>
<link rel="stylesheet" href="http://code.leafletjs.com/leaflet-0.3.1/leaflet.css" />
<script src="http://code.leafletjs.com/leaflet-0.3.1/leaflet.js"></script>
<script src="http://zeptojs.com/zepto.js" type="text/javascript"></script>
<script src="map.js" type="text/javascript"></script>
<style>
body {margin: 0; padding: 0; text-align: center;}
#button { -webkit-transition: -webkit-transform 3s ease-in; box-shadow: 0 0 25px #EFEF4D; margin: auto; margin-top: 15px; padding: 3px 6px; height: 20px; width: 200px;}
import webapp2
from webapp2_extras import local
_local = local.Local()
# The deferred handler instantiates webapp2.WSGIApplication in the module
# globals, so when it is imported it ends resetting app globals.
# To avoid this we duplicate the globals part of the WSGIApplication here,
# knowing that only we will instantiate it.
@vmihailenco
vmihailenco / httptest.go
Created September 18, 2012 08:45
httptest.go
package httptest
import (
"bytes"
"io"
"net/http"
"appengine"
)
import sys,os
sys.path.insert(0, os.environ.get('GOOGLE_APPENGINE_SDK_PATH'))
sys.path.insert(0, os.environ.get('GOOGLE_APPENGINE_NDB_PATH'))
import dev_appserver
dev_appserver.fix_sys_path()
from google.appengine.ext import testbed
t = testbed.Testbed()
os.environ['APPLICATION_ID'] = 'foo'
t.activate()
t.init_datastore_v3_stub(use_sqlite=True, datastore_file='100GzipText.sqlite')
@xpepper
xpepper / .drone.yml
Last active August 25, 2016 22:28
Setting up drone with docker
image: ruby2.0.0
script:
- cp config/database.example.yml config/database.yml
- bundle install
- psql -c 'create extension hstore;' -U postgres -h 127.0.0.1
- psql -c 'create role exmu with superuser login;' -U postgres -h 127.0.0.1
- psql -c 'create database exmu_test;' -U postgres -h 127.0.0.1
- bundle exec rake db:test:prepare
- bundle exec rspec spec
services:
@soellman
soellman / easy-k8s-coreos.md
Last active July 22, 2019 14:10
Easy Kubernetes on CoreOS

Easy Kubernetes Installation on CoreOS

At Timeline Labs, we are continuously looking at new technologies to see what fits our needs. We are especially excited about Kubernetes from Google to manage our services atop Docker and CoreOS.

This process for installing Kubernetes on CoreOS uses Flannel for Kubernetes networking and should be cloud provider agnostic. To deploy the Kubernetes master functionality into the cluster, it uses fleetctl.

Thanks to Kelsey Hightower and his blog posts! They served as a great starting point for this process.

How do I get this running?

Add the cloud config below to your own and bring up your cluster using a CoreOS version with Docker 1.3 (currently v472.0.0 in alpha). During that initial boot, the download-kubernetes and download-flannel units will download binaries from the latest project release and use those.

@proppy
proppy / docker-dev.sh
Last active August 29, 2015 14:06
docker-dev: poor man dev workflow for dockerized apps
#!/bin/bash
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@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
//
@proppy
proppy / README.md
Last active December 6, 2022 09:32
apk2layer

apk2layer

apk2layer flattens an alpine linux package(s) and its dependencies into a standalone tarball.

Usage

apk2layer [-mirror] PKGNAME... > layer.tar