Skip to content

Instantly share code, notes, and snippets.

View lumenwrites's full-sized avatar

lumenwrites lumenwrites

View GitHub Profile
function challengeUser (){
var xhr = new XMLHttpRequest();
var id = 58542; //Fuego bot user id
var url = "http://online-go.com/api/v1/players/"+id+"/challenge/";
xhr.open("POST", url, true );
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Authorization", "Bearer " + accessToken);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
.RES-keyNav-activeElement, .commentarea .RES-keyNav-activeElement .md, .commentarea .RES-keyNav-activeElement.entry .noncollapsed {
background-color: white !important;
}
.link.last-clicked {
border: none;
}
* {
color:grey!important;
@lumenwrites
lumenwrites / Pizza
Last active October 28, 2016 05:15
pizza.py
def
def slice_pizza(number_of_friends, number_of_slices):
# Cut pizza in half
number_of_slices = number_of_slices*2
# Is there enough slices for everybody?
if number_of_slices >= number_of_friends:
# If yes - return our slices, it's time to eat pizza!
return number_of_slices
else:
# If not - then cut it in half once again.
@lumenwrites
lumenwrites / ginkgo_mousetrap.js
Last active November 5, 2016 23:49
This script creates a shortcut (Alt+d) that adds a tag with the current date at the end of the card.
app.get('cards').models.map(function(c) {
Mousetrap.bind('alt+d', function(e) {
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
if(dd<10) {
dd='0'+dd
}
@lumenwrites
lumenwrites / mastodon_nginx.conf
Created April 10, 2017 19:01
Mastodon nginx conf
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
# redirect from http to https
listen 80 default_server;
listen [::]:80 default_server;
server_name hackertribe.io www.hackertribe.io;
@lumenwrites
lumenwrites / like-activity.json
Last active April 19, 2017 23:19
ActivityPub
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Like",
"id": "https://social.example/alyssa/posts/5312e10e-5110-42e5-a09b-934882b3ecec",
"to": ["https://chatty.example/ben/"],
"author": "https://social.example/alyssa/",
"object": "https://chatty.example/ben/p/51086"
}
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Person",
"id": "https://social.example/alyssa/",
"name": "Alyssa P. Hacker",
"preferredUsername": "alyssa",
"summary": "Lisp enthusiast hailing from MIT",
"inbox": "https://social.example/alyssa/inbox/",
"outbox": "https://social.example/alyssa/outbox/",
"followers": "https://social.example/alyssa/followers/",
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Note",
"to": ["https://chatty.example/ben/"],
"attributedTo": "https://social.example/alyssa/",
"content": "Say, did you finish reading that book I lent you?"
}
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Create",
"id": "https://social.example/alyssa/posts/a29a6843-9feb-4c74-a7f7-081b9c9201d3",
"to": ["https://chatty.example/ben/"],
"author": "https://social.example/alyssa/",
"object": {
"type": "Note",
"id": "https://social.example/alyssa/posts/49e2d03d-b53a-4c4c-a95c-94a6abf45a19",
"attributedTo": "https://social.example/alyssa/",