Skip to content

Instantly share code, notes, and snippets.

Gregory Clarke gregology

Block or report user

Report or block gregology

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View openvpn-install.sh
#!/bin/bash
#
# https://github.com/Nyr/openvpn-install
#
# Copyright (c) 2013 Nyr. Released under the MIT License.
# Detect Debian users running the script with "sh" instead of bash
if readlink /proc/$$/exe | grep -q "dash"; then
echo "This script needs to be run with bash, not sh"
@gregology
gregology / collision_detection.py
Last active Mar 27, 2017
Collision detection module for Python
View collision_detection.py
from datetime import datetime, timedelta
from math import asin, sin, acos, cos, atan2, tan, radians, degrees, sqrt
import operator
# lots of help from http://www.movable-type.co.uk/scripts/latlong.html
EARTHS_RADIUS = 6371 * 1000.0 # meters
class Coordinates:
View get_biometrics
curl \
-F access_token=YOUR_ACCESS_TOKEN \
-F page=1 \
-F per_page=100 \
-X GET http://memair.herokuapp.com/api/v1/biometrics
@gregology
gregology / .bashrc
Created Feb 3, 2016
Alias and alike
View .bashrc
alias brake='bundle exec rake'
alias brails='bundle exec rails'
@gregology
gregology / Dropbox Ubuntu Scripts.md
Last active Feb 2, 2016
Keeping an eye on the run away Dropbox service on Ubuntu.
View Dropbox Ubuntu Scripts.md

Dropbox Ubuntu Scripts

I was haing some trouble (OOMing and crashing) with Dropbox running on an old Ubuntu laptop so I wrote a couple of scripts to keep it in check. The first one shuts down Dropbox when a threshold load average is met (4.00). And the second one restarts the Dropbox process if it crashes.

Crontab

*/10 * * * * ~/dropbox_restarter.sh >> ~/dropbox_restarter.log
*/1 * * * * ~/dropbox_load_limiter.sh >> ~/dropbox_load_limiter.log
View gist:3888cd27402175988376
from __future__ import unicode_literals
import pytest
from starscream.records import Record
class TestBug():
def create_field_1_based_rdd(self, foo_rdd):
return foo_rdd.map(lambda rec: rec.rename_keys(id='int field')
.merge({
View gist:97cf4cb7ac973ac62e2e
foo = sc.records([{'foo': 123}, {'foo': 321}])
bar = sc.records([{'bar': 123}, {'bar': 321}])
baz = sc.records([{'baz': 123}, {'baz': 321}])
qux = foo.cartesian(bar)\
.map(lambda (x,y): x.merge(y))\
.cartesian(baz)\
.map(lambda (x,y): x.merge(y))
qux.collect()
View free_email_provider_domains.txt
1033edge.com
11mail.com
123.com
123box.net
123india.com
123mail.cl
123qwe.co.uk
150ml.com
15meg4free.com
163.com
@gregology
gregology / dashboard
Last active Jun 3, 2019
Service script for dashing. Update DASHING_DIR variable, add this file to /etc/init.d/ , chmod to 755, and let update rc.d with $ sudo update-rc.d dashboard defaults This scripts stops the dashing service with "killall thin" which will kill all thin services running on your server.
View dashboard
#!/bin/bash
# Dashing service
# Add this file to /etc/init.d/
# $ sudo cp dashboard /etc/init.d/
# Update variables DASHING_DIR, GEM_HOME, & PATH to suit your installation
# $ sudo nano /etc/init.d/dashboard
# Make executable
# $ sudo chmod 755 /etc/init.d/dashboard
# Update rc.d
# $ sudo update-rc.d dashboard defaults
@gregology
gregology / README.md
Created Mar 19, 2013
Facebook link stats
View README.md

Setup

Put the facebooklinkstats.rb to jobs/facebooklinkstats.rb.

Add the code from facebooklinkstats.erb to the desired dashboard.

Preview

You can’t perform that action at this time.