Skip to content

Instantly share code, notes, and snippets.

View readevalprint's full-sized avatar
🤠
code is life

Tim readevalprint

🤠
code is life
View GitHub Profile
'''
from nltk import CFG
from nltk.parse.generate import demo_grammar
grammar = CFG.fromstring(demo_grammar)
s = list(grammar._lhs_index.keys())[0]
generate_sample(grammar, s, 1, 10)
'''
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)
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);
}
pragma solidity 0.4.11;
contract Foo {
event Debug(string msg);
modifier checkThis(string action) {
Debug(action);
_;
}

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 November 8, 2016 16:05 — forked from naholyr/_service.md
Sample /etc/init.d script

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 July 29, 2015 23:28
Outline of my talk "Smart Smart Contracts: AI on the blockchain"
// test
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>