View leak.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import time | |
import gc | |
gc.disable() | |
def const_cmp(str1, str2): | |
res = len(str1) ^ len(str2) | |
for a, b in zip(str1, str2): | |
res |= ord(a) ^ ord(b) |
View chacha20.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on http://cr.yp.to/streamciphers/timings/estreambench/submissions/salsa20/chacha8/ref/chacha.c | |
import binascii | |
import numpy as np | |
np.seterr(over='ignore') | |
def rotl32(v, c): | |
assert isinstance(v, np.uint32) | |
assert isinstance(c, np.uint32) |
View pysidesignal.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PyObject* signalInstanceEmit(PyObject* self, PyObject* args) | |
{ | |
PySideSignalInstance* source = reinterpret_cast(self); | |
Shiboken::AutoDecRef pyArgs(PyList_New(0)); | |
Shiboken::AutoDecRef sourceSignature(PySide::Signal::buildQtCompatible(source->d->signature)); | |
PyList_Append(pyArgs, sourceSignature); | |
for (Py_ssize_t i = 0, max = PyTuple_Size(args); i d->source, "emit")); |
View error.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import logging | |
from functools import partial | |
from PySide import QtCore, QtGui | |
class Obj(QtCore.QObject, logging.Handler): | |
sig = QtCore.Signal(dict) | |
def __init__(self): |
View test_soledad_server.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from leap.soledad import Soledad | |
import logging | |
level = logging.DEBUG | |
logger = logging.getLogger(name='leap') | |
logger.setLevel(level) | |
console = logging.StreamHandler() | |
console.setLevel(level) |
View sendmail.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import telnetlib | |
if __name__ == "__main__": | |
mail = { | |
"from": sys.argv[1], | |
"to": sys.argv[2], | |
"subject": sys.argv[3], | |
"msg": sys.argv[4] |
View components.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Base | |
{ | |
public: | |
Base() {} | |
virtual ~Base() {} | |
}; | |
class NotCopyable | |
{ | |
public: |
View components.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FirstComponent(object): | |
def __init__(self, parent): | |
object.__init__() | |
parent.someFunc = self.someFunc | |
def someFunc(self): | |
return 42 | |
class GameObject(object): | |
def __init__(self): |
View defer.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <functional> | |
#include <stack> | |
class Deferrer | |
{ | |
public: | |
Deferrer() {} | |
~Deferrer() { callAll(); } |
View defer2.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func b() { | |
for i := 0; i < 4; i++ { | |
defer fmt.Print(i) | |
} | |
} |
NewerOlder