Skip to content

Instantly share code, notes, and snippets.

View randomradio's full-sized avatar
🎯
Focusing

i.an randomradio

🎯
Focusing
View GitHub Profile

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@randomradio
randomradio / maps.utils.js
Last active June 27, 2017 20:15 — forked from joseadrian/maps.utils.js
Google Maps. Detect if one of the points on the polyline paths intersects a circle
(function(){
var polyline = new google.maps.Polyline();
google.maps.Polyline.prototype.closestDistanceToSegment = function(center, segment)
{
var firstPoint, lastPoint, A, B, C, D, E, distanceAB, t, projection = this.getMap().getProjection();
// The other extreme of the path
lastPoint = segment[0];
@randomradio
randomradio / karabiner xml
Last active March 20, 2017 16:59
my karabiner configuration, continue in progress
<?xml version="1.0"?>
<root>
<devicevendordef>
<vendorname>VORTEX</vendorname>
<vendorid>0x04d9</vendorid>
</devicevendordef>
<deviceproductdef>
<productname>POK3R</productname>
<productid>0x0141</productid>
@randomradio
randomradio / ShapeWriter.py
Last active December 2, 2015 22:50
shape file writer works on appengine
class ShapeWriter:
"""Provides write support for ESRI Shapefiles."""
def __init__(self, shapeType=None):
self._shapes = []
self.fields = []
self.records = []
self.shapeType = shapeType
self.shp = None
self.shx = None
self.dbf = None
@randomradio
randomradio / .tmux.conf
Last active December 14, 2015 18:46 — forked from snuggs/.tmux.conf
TMUX configuration file
##############################
# _
# | |_ _ __ ___ _ ___ __
# | __| '_ ` _ \| | | \ \/ /
# | |_| | | | | | |_| |> <
# \__|_| |_| |_|\__,_/_/\_\
#
#############################
#
# COPY AND PASTE
@randomradio
randomradio / index.html
Created January 13, 2016 02:00
openLayer google map integration
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The HTML5 Herald</title>
<meta name="description" content="The HTML5 Herald">
<meta name="author" content="SitePoint">
@randomradio
randomradio / grab_python_weekly.py
Created March 16, 2016 00:08
sample plugin to grab python weekly issues for a slack bot webhook
# coding=utf-8
import re
import requests
from bs4 import BeautifulSoup
from utils import check_cache
from pycoders import MyHTMLParser
URL = 'http://us2.campaign-archive1.com/home/?u=e2e180baf855ac797ef407fc7&id=9e26887fc5' # noqa
@randomradio
randomradio / logger.py
Created July 20, 2016 22:43
minimal python logger
import sys
class Logger(object):
"""
this object will repalce default stdout object.
logging info into terminal with sys.stdout
save logging info into log file
{TODO} accept log file as argument
"""
def __init__(self):
@randomradio
randomradio / sqrt.go
Created February 14, 2017 21:39
golang newton sqrt
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := 1.0
for {
@randomradio
randomradio / renren_image_download_example.py
Created February 26, 2017 08:46
人人网照片导出样本script。renren.com image export sample script
#!/usr/bin/env python
# pip install renren
from renren import APIClient
import pprint
import json
import requests
def get_my_image(image_url, folder, name,):
img_data = requests.get(image_url).content
with open(name + '.jpg', 'wb') as handler: