Skip to content

Instantly share code, notes, and snippets.

View reallistic's full-sized avatar

Michael reallistic

View GitHub Profile
@reallistic
reallistic / prettyprintgistorgithub.md
Last active September 25, 2019 21:44 — forked from mash/prettyprintgist.md
Bookmarklet to pretty print Gist and Github pages without the usual page chrome, just content. Handy for Markdown document printing.

Pretty print bookmarklet helper for Gist pages

Create a new bookmark somewhere handy in your browser with the following URL:

javascript:var el=document.createElement('style');el.media='print';el.innerHTML='#header,.pagehead.repohead,.gist-description.container,.file-box .meta,#comments,.js-comment-form,.gist-header,.file-header,.gisthead,#footer,div.commit-tease,div.file-navigation{display:none;}.file-box{border:0!important;}';document.getElementsByTagName('head')[0].appendChild(el);alert('Now, cmd+p to print');
  • Navigate to your Gist of choice
  • Hit the bookmarklet
  • Now print
@reallistic
reallistic / comments.py
Last active September 2, 2017 23:43
Push notifications model in Python
from .payload import PayloadFactory, Payload
class Comment:
text: str
def __init__(self, text: str) -> None:
self.text = text
@staticmethod
import superagent from 'superagent';
import { WebsocketService } from './services';
export function getData() {
return superagent.get('/api/').then(response => {
return response.body;
});
}
@reallistic
reallistic / todo.jsx
Last active June 26, 2017 21:57 — forked from caike/todo.jsx
Simple Todo app demo using React + ES6
var React = require("react");
var request = require("requests");
var allItems = []
allItems.push("Buy ingredients for Crock Pot");
allItems.push("Pick up chair at IKEA");
allItems.push("Go see mom");
class TodoList extends React.Component {
constructor(props){
@reallistic
reallistic / install-redis.sh
Last active April 20, 2017 21:37 — forked from khelll/install-redis.sh
Installing Redis on Amazon Linux
#!/bin/bash
###############################################
# To use:
# chmod +x install-redis.sh
# ./install-redis.sh
###############################################
version=3.2.8
echo "*****************************************"
echo " 1. Prerequisites: Install updates, set time zones, install GCC and make"
@reallistic
reallistic / FlaskLogging.py
Created February 27, 2017 17:41
Example logging setup with python flask
import logging
from flask import Flask
from threading import Lock
# a lock used for logger initialization
_logger_lock = Lock()
class MyCustomLogger(object):
@reallistic
reallistic / keybase.md
Created August 24, 2016 16:34
Keybase proof

Keybase proof

I hereby claim:

  • I am reallistic on github.
  • I am mikechase (https://keybase.io/mikechase) on keybase.
  • I have a public key ASDmhxjPt3vb10Y0WTYlac0EP6voXcg7s_diWIUEvnOC1go

To claim this, I am signing this object:

@reallistic
reallistic / locustfile.py
Created June 12, 2016 22:31
Websocket client for locust.io (SockJS)
import time
import json
import gevent
from uuid import uuid4
from locust import HttpLocust, TaskSet, task, ResponseError, events, Locust
import websocket
class SocketClient(object):
@reallistic
reallistic / copy_heroku_config.sh
Last active August 29, 2015 14:19
Simple bash script to copy the config from one heroku app to another
#!/bin/bash
OIFS=$IFS
print_usage ()
{
echo "Usage:"
echo " $0 source-appname"
echo " $0 source-appname dest-appname"
}
cleanup_and_exit ()