Skip to content

Instantly share code, notes, and snippets.

View pirate's full-sized avatar
🗃️
Archiving all the things!

Nick Sweeting pirate

🗃️
Archiving all the things!
View GitHub Profile

Keybase proof

I hereby claim:

  • I am pirate on github.
  • I am nikisweeting (https://keybase.io/nikisweeting) on keybase.
  • I have a public key ASAkuTPmwBtAZG-xmUmPOsqC7NN90ZmmCOXvUx1EcLtRKQo

To claim this, I am signing this object:

stems = ARGF.read
.split
.each_cons(2)
.group_by { |word_pair| word_pair[0] }
def next_word ary
ary[rand(ary.length).to_i][1]
end
e = Enumerator.new do |e|
# -*- coding: utf-8 -*-
# ~/.pythonrc
# add this to your ~/.bashrc:
# export PYTHONSTARTUP="~/.pythonrc"
### Common Useful Imports
import os, sys
import datetime, time, random
import socket, json, re, pdb
try:
def save(self, *args, **kwargs):
if self.id:
on_disk = Game.objects.get(pk=self.id)
if on_disk.modified > self.modified:
raise StaleWriteError('Tried to save outdated Game')
super(Game, self).save(*args, **kwargs)
ul [ class "nav navbar-nav main-nav" ]
[ li [ class "sup", attribute "data-what" "" ]
[ a [ href "", title "Home" ]
[ i [ class "fa fa-house" ]
[]
, text " Home "
]
]
, li [ class "spacer" ]
[ text "|" ]
@pirate
pirate / inferno-bug.js
Created January 5, 2017 22:15
Bug when using inferno.js
import Inferno from 'inferno'
import {Provider} from 'inferno-redux'
import {createStore, combineReducers} from 'redux'
window.initial_state = {}
window.react_mount = document.getElementById('react')
window.store = createStore(
combineReducers({}), // reducers ommited because not needed to reproduce bug
window.initial_state,
)
@pirate
pirate / libssl_python3.6_crash_dump.txt
Created January 19, 2017 20:52
Crash dump for a libssl bug on python3.6 on mac
Process: python3.6 [2275]
Path: /Users/USER/*/python3.6
Identifier: python3.6
Version: ???
Code Type: X86-64 (Native)
Parent Process: fish [98071]
Responsible: python3.6 [2275]
User ID: 501
Date/Time: 2017-01-19 15:31:21.532 -0500
@pirate
pirate / libssl_bug.py
Created January 19, 2017 20:53
Code needed to reproduce libssl bug on python3.6 on mac
#!/usr/bin/env python3.6
"""
Code needed to reproduce a libssl segfault with python3.6 on mac.
To run:
brew upgrade python3
pip3 install websocket-client
python3.6 libssl_bug.py
import React from 'react'
import ReactDOM from 'react-dom'
const Leaderboard = ({users}) =>
<div>
<h1>Featured Players</h1>
{users.map(user =>
<a href={`/user/${user.username}/`}>
{user.username}
public class ScopeTest {
public static void main(String[] args) {
int result = 0;
addNumbers(12, 24);
System.out.println(result);
}