Skip to content

Instantly share code, notes, and snippets.

View jaywink's full-sized avatar
💭
Federating

Jason Robinson jaywink

💭
Federating
View GitHub Profile
import argparse
import resource
import aiohttp
import aiodns
import asyncio
from collections import Counter
import datetime
@igniteflow
igniteflow / mock-object-property.py
Created October 3, 2016 11:03
How to mock an object property in Python
import mock
with mock.patch('path.to.ObjectClass.my_property', new_callable=mock.PropertyMock) as mock_my_property:
mock_my_property.return_value = 'my value'
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@jhass
jhass / diaspora_spam.rb
Last active February 14, 2022 09:43
Deletes spam comments, posts and local spam accounts. Place into Diasporas root, edit and run. Don't forget to set necessary environment variables.
#!/usr/bin/env ruby
# List of spam accounts
spam_accounts = %w(spamacc@podA spamacc@podB spamacc@mypod)
# Delete comments even if spammer isn't a local user or spam isn't on a
# local users account.
# And delete posts of users in spam_accounts that aren't local.
always_delete = true
@cgoldberg
cgoldberg / gource.sh
Created July 2, 2013 14:05
Gource - Mir development video
# install bzr and gource
# get a branch of Mir's trunk code
# create gource video
$ sudo apt-get install bzr gource
$ bzr branch lp:mir
$ cd mir
$ gource \
-s .06 \
#! /bin/bash
START_DIR=$PWD
DIASPORA_DIR="/var/vhosts/diaspora.digitalignition.net/diaspora"
DEFAULT_BRANCH="develop"
UNICORN_EXEC="service unicorn"
UNICORN_CONF="/etc/unicorn/diaspora.conf"
RAILS_ENV="production"
function diaspora_unicorn_service() {
if [ $# -lt 1 ]; then
@yurydelendik
yurydelendik / .htaccess
Last active August 7, 2023 14:01
CORS for pdf.js
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "http://mozilla.github.io"
</IfModule>
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active April 2, 2024 15:59
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
@mbrochh
mbrochh / factories.py
Created April 21, 2012 02:47
Django UserFactory with factory_boy
import datetime
import md5
from django.contrib.auth.models import User
import factory
class UserFactory(factory.Factory):
"""
@huyng
huyng / reflect.py
Created February 7, 2011 17:57
A simple echo server to inspect http web requests
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):