Skip to content

Instantly share code, notes, and snippets.

import asyncio
import json
import logging
import random
import re
from datetime import datetime, timezone
from typing import Any, Dict, List, Optional, Pattern, Set, Tuple
import aiohttp
import websockets
@Zenithar
Zenithar / mastodon.yml
Created April 10, 2017 09:52
OpenAPI / Swagger Mastodon API Specification
swagger: '2.0'
info:
title: Mastodon API
description: API for GNU Social-compatible microblogging server
version: '1.1.1'
contact:
name: Mastodon API Team
url: https://github.com/tootsuite/mastodon
license:
name: AGPL
@veselosky
veselosky / s3gzip.py
Last active August 29, 2024 11:32
How to store and retrieve gzip-compressed objects in AWS S3
# vim: set fileencoding=utf-8 :
#
# How to store and retrieve gzip-compressed objects in AWS S3
###########################################################################
#
# Copyright 2015 Vince Veselosky and contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@preslavrachev
preslavrachev / setting-up-a-new-mac-for-development.md
Last active September 8, 2017 16:11
Some important steps and tools for setting up a new Mac and making it ready for development (in particular, Java development, but most of the steps matter for others too)

Setting Up a New Mac for Development

Command-Line Utilities

Homebrew

An absolute must. If you have ever worked with apt-get on Ubuntu, you know that it's the absolute developer bliss. Homebrew (or brew for short) is the missing package manager for OSX. Not only does it allow you to install/unisnstall/manage software with a few simple commands, the same way that apt-get does. It allows you to access and install ports of most of the cross-platform utilities that you might be familiar with from Linux, over to OSX.

Installing Brew

Simply open a new terminal and execute the following command:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
func checkOverflow(result, op1, op2 uint8) bool {
// (op1 ^ op2) & 0x80: zero if both operands had the same sign bit
// (op1 ^ result) & 0x80: non-zero if the result is a different sign
// from the operands
// So it returns true if either:
// both operands are positive but the result is negative
// or vice-versa
return (((op1 ^ op2) & 0x80) == 0) && (((op1 ^ result) & 0x80) != 0)
}
@tqbf
tqbf / gist:3185200
Created July 26, 2012 23:21
Crypto syllabus #6
I have met them at close of day
Coming with vivid faces
From counter or desk among grey
Eighteenth-century houses.
I have passed with a nod of the head
Or polite meaningless words,
Or have lingered awhile and said
Polite meaningless words,
And thought before I had done
Of a mocking tale or a gibe