Skip to content

Instantly share code, notes, and snippets.

Avatar
🤠
code is life

Tim readevalprint

🤠
code is life
View GitHub Profile
View ddtb.py
def show_debug_toolbar(request):
if request.__class__.__name__ == "AsgiRequest":
return (
b"DEBUG" in request.scope["query_string"]
or "djdt=show" in request.META.get("HTTP_COOKIE", "")
) and (DEBUG or request.user.is_superuser)
s = (
"DEBUG" in request.environ.get("QUERY_STRING", "")
or "djdt=show" in request.environ.get("HTTP_COOKIE", "")
) and (DEBUG or request.user.is_superuser)
View SimpleCron.sol
pragma solidity 0.4.15;
contract SimpleCron {
/// @notice Will return the next timesamp after the speicifed units have passed `timestamp`
function next(uint s,uint m,uint h, uint d, uint w, uint timestamp) constant returns (uint){
return (timestamp * 1 seconds) + (s * 1 seconds) + (m * 1 minutes) + (h * 1 hours) + _days(d) + _weeks(w);
}
View Foo.sol
pragma solidity 0.4.11;
contract Foo {
event Debug(string msg);
modifier checkThis(string action) {
Debug(action);
_;
}
View keybase.md

Keybase proof

I hereby claim:

  • I am readevalprint on github.
  • I am readevalprint (https://keybase.io/readevalprint) on keybase.
  • I have a public key ASD-995N5m2iZEtYNV0P_9VSpq2CycQv-krC4srA6BzYbAo

To claim this, I am signing this object:

@readevalprint
readevalprint / _service.md
Last active Nov 8, 2016 — forked from naholyr/_service.md
Sample /etc/init.d script
View _service.md

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@readevalprint
readevalprint / smart-smart-contracts-outline.md
Created Jul 29, 2015
Outline of my talk "Smart Smart Contracts: AI on the blockchain"
View smart-smart-contracts-outline.md
View directions
Lesson 1: Namespace.
Why is this broken, and how would you fix it?
Directions:
$ wget https://gist.github.com/readevalprint/7653435/raw/random.py
$ python ./random.py
random() :
Traceback (most recent call last):
File "./random.py", line 2, in <module>
@readevalprint
readevalprint / serializer.py
Created Sep 25, 2013
django-haystack SearchResultSerializer from django-rest-framework
View serializer.py
==== SNIP ====
class DistanceSerializer(serializers.Serializer):
km = serializers.FloatField()
m = serializers.FloatField()
mi = serializers.FloatField()
ft = serializers.FloatField()
class SearchResultSerializer(serializers.Serializer):