Skip to content

Instantly share code, notes, and snippets.

View zmallen's full-sized avatar

Zack Allen zmallen

View GitHub Profile
from Crypto.Cipher import AES
import os, struct, sys, httplib, urllib
from sys import platform as _platform
import subprocess as sub
class lolCrypt:
def __init__(self, key, iv):
self.key = key
self.iv = iv
self.cryptor = AES.new(self.key, AES.MODE_CBC, self.iv)
### Keybase proof
I hereby claim:
* I am zmallen on github.
* I am techy (https://keybase.io/techy) on keybase.
* I have a public key whose fingerprint is 8E36 C455 CB01 93A0 9BC4 F137 6F14 907A 4B66 7C2C
To claim this, I am signing this object:
@zmallen
zmallen / strace
Created September 25, 2014 16:56
write(2, "*BUG* File: [compress.c] Line: ["..., 36) = 36
rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
tgkill(13317, 13317, SIGABRT) = 0
--- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=13317, si_uid=11176} ---
rt_sigreturn() = 0
rt_sigaction(SIGABRT, {SIG_DFL, ~[], SA_RESTORER, 0x7f3191151c30}, NULL, 8) = 0
tgkill(13317, 13317, SIGABRT) = 0
--- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=13317, si_uid=11176} ---
+++ killed by SIGABRT (core dumped) +++
<div class="modal fade" id="basicModal" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="addRaceModal">Add a Race</h4>
</div>
<div class="modal-body">
<label for="sel1">Select season:</label>
<select class="form-control" id="sel1">
<option>Spring</option>

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

private int determinant(int row, int col, int size) {
int sum = 0;
if(size == 1) {
return this.data[0][0];
}
else if (size == 2) {
return (this.data[row][col] * this.data[row+1][col+1]) - (this.data[row][col+1] * this.data[row+1][col]);
} else {
return determinant(row+1,col+1,size);
}
java.lang.RuntimeException: java.io.NotSerializableException: com.fasterxml.jackson.module.paranamer.shaded.CachingParanamer
at backtype.storm.serialization.DefaultSerializationDelegate.serialize(DefaultSerializationDelegate.java:43) ~[storm-core-0.9.5.jar:0.9.5]
at backtype.storm.utils.Utils.serialize(Utils.java:85) ~[storm-core-0.9.5.jar:0.9.5]
at backtype.storm.topology.TopologyBuilder.createTopology(TopologyBuilder.java:106) ~[storm-core-0.9.5.jar:0.9.5]
at fastly.storm.topology.FastlyTopology$.main(Topology.scala:21) ~[classes/:na]
at fastly.storm.topology.FastlyTopology.main(Topology.scala) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_66]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_66]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_66]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_66]
import java.util
import backtype.storm.task.{TopologyContext, OutputCollector}
import backtype.storm.topology.OutputFieldsDeclarer
import backtype.storm.topology.base.BaseRichBolt
import backtype.storm.tuple.{Fields, Values, Tuple}
import java.util.{Map => JMap}
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import com.fasterxml.jackson.module.scala.experimental.ScalaObjectMapper
---
driver:
name: vagrant
provisioner:
name: chef_solo
require_chef_omnibus: 11.18.12-1
platforms:
- name: ubuntu-12.04
2015-12-15T00:05:51.008+0000 o.a.s.z.ClientCnxn [INFO] Opening socket connection to server 192.168.50.128/192.168.50.128:2181. Will not attempt to authenticate using SASL (unknown error)
2015-12-15T00:05:51.010+0000 o.a.s.z.ClientCnxn [WARN] Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.7.0_91]
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:744) ~[na:1.7.0_91]
at org.apache.storm.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361) ~[storm-core-0.9.5.jar:0.9.5]
at org.apache.storm.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081) ~[storm-core-0.9.5.jar:0.9.5]