Skip to content

Instantly share code, notes, and snippets.

View jbarciauskas's full-sized avatar

Joel Barciauskas jbarciauskas

View GitHub Profile
This file has been truncated, but you can view the full file.
#!/usr/bin/env bash
# This script will provision all of the services. Each service will be setup in the following manner:
#
# 1. Migrations run,
# 2. Tenants—as in multi-tenancy—setup,
# 3. Service users and OAuth clients setup in LMS,
# 4. Static assets compiled/collected.
courses.edx.org: 6400833, 2083916 ips
localhost:8003: 2917976, 1633 ips
localhost:8031: 2052623, 1561 ips
mx.televisioneducativa.gob.mx: 895651, 320584 ips
courses.prometheus.org.ua: 635127, 164952 ips
university.mongodb.com: 533343, 156873 ips
lagunita.stanford.edu: 517823, 231515 ips
lms.gacco.org: 359490, 144340 ips
openedx.microsoft.com: 324869, 2413 ips
edge.edx.org: 253323, 55680 ips
courses.edx.org: 7069711, 2273815 ips
localhost:8003: 3240540, 1762 ips
localhost:8031: 2256333, 1685 ips
mx.televisioneducativa.gob.mx: 940894, 337005 ips
courses.prometheus.org.ua: 727178, 180075 ips
university.mongodb.com: 578184, 169856 ips
lagunita.stanford.edu: 567218, 251619 ips
lms.gacco.org: 391341, 154351 ips
openedx.microsoft.com: 365213, 2577 ips
edge.edx.org: 282402, 60226 ips
import requests
r = requests.get('https://api.gemnasium.com/v1/projects', auth=('X', 'e05c25f9248015c5aebb26049719ed23'))
data = r.json()
for repo in data['edx-gemnasium']:
print repo['slug']
r = requests.get('https://api.gemnasium.com/v1/projects/' + repo['slug'] + '/dependencies', auth=('X', 'e05c25f9248015c5aebb26049719ed23'))
dependencies = r.json()
require 'fog'
require 'pp'
require 'active_support'
AWS = Fog::Compute.new :provider => 'AWS'
AWS.snapshots.each do |snapshot|
if snapshot.tags['Name'] =~ /pod\d*{3}-\w*-\d*/
if(DateTime.parse(snapshot.created_at.to_iso8601_basic) < (DateTime.now << 1))
@jbarciauskas
jbarciauskas / gist:3298944
Created August 8, 2012 21:30
try to get multiple locks in mysql
mysql> select get_lock('foo', 1200);
+-----------------------+
| get_lock('foo', 1200) |
+-----------------------+
| 1 |
+-----------------------+
1 row in set (0.00 sec)
mysql> select get_lock('bar', 1200);
<?php
require_once("BitArray.php");
$test = new BitArray(128);
$test->setBit(12);
var_dump($test->toIntArray());
$test2 = new BitArray(128);
$test2->setBit(126);
var_dump($test2->toIntArray());
$test3 = BitArray::orFn($test, $test2);
var_dump($test3->toIntArray());
<?php
class BitArray {
//Sacrifice 2x the amount of memory, so we can use pack/unpack easily
const INT_SIZE = 4;
private $bitmapString;
public function __construct($numberOfBits = 64, $bitmapString = null) {
if($bitmapString!= null)
require_once("BitArray.php");
$test = new BitArray(128);
$test->setBit(12);
$test2 = new BitArray(128);
$test2->setBit(126);
$test3 = BitArray::orFn($test, $test2);
var_dump($test3);
var_dump($test);
var_dump($test2);
$test2 = new BitArray(60);