Skip to content

Instantly share code, notes, and snippets.

View brianly's full-sized avatar
🦙
Don't get much time to hack right now due to 👶

Brian Lyttle brianly

🦙
Don't get much time to hack right now due to 👶
View GitHub Profile
#!/usr/bin/env python
#
# Converts any integer into a base [BASE] number. I have chosen 62
# as it is meant to represent the integers using all the alphanumeric
# characters, [no special characters] = {0..9}, {A..Z}, {a..z}
#
# I plan on using this to shorten the representation of possibly long ids,
# a la url shortenters
#
---
### CONFIGURE REPOSITORIES ###
- name: install python-software-properties
action: apt name='python-software-properties' state=installed
- name: "add nginx ppa if ubuntu 10.04 and up"
action: apt_repository repo=ppa:nginx/stable
only_if: "$is_ubuntu and $is_10_up"
@brianly
brianly / deploy.sh
Last active December 22, 2015 01:48
Some random configuration for an Ubuntu server instance that wants to popup a dialog a little too much.
#!/bin/bash
echo 'DEBIAN_FRONTEND="noninteractive"' >> /etc/profile
@brianly
brianly / gist:6242214
Last active December 21, 2015 03:29
PowerShell snippet showing how to delete a user in a Yammer network.
function Yammer-HttpDelete([string]$target,[string]$token) {
try {
# Setup the request
$webRequest = [System.Net.WebRequest]::Create($target)
$webRequest.Method = "DELETE"
$webRequest.Headers.Add("Authorization", "Bearer $token");
# Execute the request
[System.Net.WebResponse]$resp = $webRequest.GetResponse();
$rs = $resp.GetResponseStream();
@brianly
brianly / gist:6236102
Last active December 21, 2015 02:38
Suspending a Yammer user with PowerShell.
function Invoke-HttpDelete([string]$target, [string]$token) {
try {
# Setup the request
$webRequest = [System.Net.WebRequest]::Create($target)
$webRequest.Method = "DELETE"
$webRequest.Headers.Add("Authorization", "Bearer $token");
# Execute the request
[System.Net.WebResponse]$resp = $webRequest.GetResponse();
$rs = $resp.GetResponseStream();
@brianly
brianly / activity-response
Created August 13, 2013 19:43
Example response returns "202 Accepted" and the JSON below.
{
"actor_id": 1491478840,
"object_id": 352364218665986,
"action_id": 837943
}
@brianly
brianly / activity
Created August 13, 2013 19:41
Example JSON activity stream post to https://www.yammer.com/api/v1/activity.json.
{
"activity": {
"actor": {
"name": "Brian Lyttle",
"email": "[email protected]"
},
"action": "yammermvc:publish",
"object": {
"url": "http://localhost:33128/media/detail?id=33",
"description": "",
POST https://www.yammer.com/api/v1/activity.json HTTP/1.1
Authorization: Bearer REMOVED
Content-Type: text/plain; charset=utf-8
Host: www.yammer.com
Content-Length: 494
Expect: 100-continue
Connection: Keep-Alive
{"activity":{"actor":{"name":"Jim Martin","email":"[email protected]"},"action":"yammermvc:publish","object":{"url":"https://dox.com/file/abc123.pdf","description":"A set of charts showing the ROI of deploying Yammer over time.","video":{"width":1,"height":1},"type":"yammermvc:photo","title":"Yammer ROI.pdf","image":"https://dox.com/file/abc123.pdf"},"private":"false","message":"This is the updated version for the conference.","users":[{"name":"Brian Davis","email":"[email protected]"}]}}
@brianly
brianly / gist:6034957
Created July 19, 2013 03:42
What's wrong with this?
{
"activity": {
"actor": {
"name": "Jim Martin",
"email": "[email protected]"
},
"action": "yammermvc:publish",
"object": {
"url": "https://dox.com/file/abc123.pdf",
"description": "A set of charts showing the ROI of deploying Yammer over time.",
@brianly
brianly / gist:6031434
Created July 18, 2013 17:54
How many things are wrong with this?
<!doctype html>
<html>
<head>
<script data-app-id="YOUR APP ID" src="https://assets.yammer.com/platform/yam.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
</head>
<body>
<script>
$(function() {
$('head').append('<meta property="og:title" content="Site Title" /> ');