Skip to content

Instantly share code, notes, and snippets.

View tankbusta's full-sized avatar

Christopher Schmitt tankbusta

View GitHub Profile
@tankbusta
tankbusta / login.jade
Created September 11, 2013 17:52
Hehe
doctype 5
html(lang='en')
head
meta(charset='utf-8')
meta(name='viewport', content='width=device-width, initial-scale=1.0')
meta(name='description', content='')
title Snowman » Login
link(href='/stylesheets/bootstrap.css', rel='stylesheet')
link(href='/stylesheets/signin.css', rel='stylesheet')
link(href='/stylesheets/clippy.css', rel='stylesheet')
class Article < ActiveRecord::Base
has_one :category
has_one :workflow_state
end
class WorkflowState < ActiveRecord::Base
belongs_to :article
validates :name, presence: true
validates :description, presence: true
#!/usr/bin/ruby
require 'rubygems'
require 'active_record'
require './lib/kernel_logger'
require './models/indicator'
require 'ffi-rzmq'
require 'bson'
ctx = ZMQ::Context.new

socket._fileobject schenanigans

Let's say you're uploading a file with a length of 113914 bytes at a default chunk size of 8192. On the last .read() it'll block on data = self._sock.recv(left) inside socket.py because 113914 - 106496 equals 7418 which is less than the block size of 8192. It'll only release when the additional 774 bytes come in. (Hint™ they wont be coming)

The .read() method inside socket.py should, in my opinion operate like the working example shown below where left is calculated by .tell() (total content length of the socket) minus the size left in the buffer. If that is less than the size specified in .read() use that as left.

Related

PUT /test/
{
"mappings": {
"test": {
"properties": {
"test_dynmap": {
"type": "object",
"dynamic_templates": [
{
"nested_src_id": {
import ctypes
from ctypes.util import find_library
libc = ctypes.cdll.LoadLibrary(find_library("c"))
CTL_KERN = 1
KERN_PROC = 14
KERN_PROC_ALL = 0
class proc(ctypes.Structure):
class SuperCoolObject(object):
def __init__(self, *args, **kwargs):
self.me = self
self.herro = 'world'
class testing(SuperCoolObject):
def __init__(Self, *args, **kwargs):
super(testing, self).__init__(*args, **kwargs)
self.hello = 'world'
print(self.me) # >> <SuperCoolObject @13337>
>>> for blah in ('apples', 'oranges', 'grapes'):
... print(blah)
... else: #should be finally in my opinion
... print('done iterating')
...
apples
oranges
grapes
done iterating
>>>
>>> def addthings(a: int, b: int) -> int:
... return a+b
...
>>> addthings(2, 2)
4
>>> addthings('mindblown', 2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in addthings
TypeError: Can't convert 'int' object to str implicitly

Keybase proof

I hereby claim:

  • I am tankbusta on github.
  • I am tankbusta (https://keybase.io/tankbusta) on keybase.
  • I have a public key whose fingerprint is 26F3 7665 0EB0 4792 8E44 3696 69F9 6DF0 1A75 C250

To claim this, I am signing this object: