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 pyspark import SparkContext, SparkConf | |
def reduce_by_max(rdd): | |
""" | |
Helper function to find the max value in a list of values i.e. triplets. | |
""" | |
max_val = rdd[0][2] | |
the_index = 0 | |
for idx, val in enumerate(rdd): |
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
!#/bin/bash | |
find ./ -name *.jpg* -exec mogrify -format png *.jpg {} \; |
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 libcpp.vector cimport vector | |
cdef convert_memview_to_vector(double[::1] &mem): | |
cdef vector[double] arr | |
arr.reserve(mem.shape[0]) | |
for i in mem: | |
arr.push_back(i) | |
return arr | |
cdef convert_vector_to_memview(vector[double] &vec): |
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
const express = require('express') | |
const app = express() | |
const DC = require('discovery-channel') | |
const crypto = require('crypto') | |
app.get('/', (req, res) => { | |
console.log('Received a request') | |
res.send('Hello World') | |
}) | |
const port = 30000 |
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
const DC = require('discovery-channel') | |
const crypto = require('crypto') | |
const http = require('http'); | |
let id = process.argv[2] | |
if (!id) { | |
console.log('You must have an ID') | |
process.exit(1) |
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
const {Either, IO} = require('monet') | |
const {compose, map} = require('ramda') | |
// Pretend to get a database entry | |
// getUser :: String -> IO ( JSON ) | |
var getUser = username => IO(() => (username === 'Marge') ? {name: 'Marge Simpson', address: '123 Fake St'} : {error: 'user ' + username + ' not found!'}) | |
// Pretend to upload some information | |
// uploadUser :: JSON -> IO () | |
var uploadUser = user => IO(() => console.log('Uploading user: ', user.name, ' at address', user.address)) |
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
var html = require('choo/html') // 1. | |
var choo = require('choo') | |
var app = choo() // 2. | |
app.route('/', function(state, emit) { // 3. | |
return html` | |
<body> <!-- 4. --> | |
Hello World | |
</body> | |
` |
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 { generateKey, encryptDocument, decryptDocument, ready } from 'easy-doc-crypt' | |
import Datastore = require('nedb') | |
(async function() { | |
await ready() | |
const key = generateKey('MyPassword123') | |
function encrypt(serialized :string) { | |
console.log('encrypt') | |
let d = encryptDocument(key.secret, serialized) |
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
const PouchDB = require('pouchdb') | |
const tmp = require('tmp'); | |
const assert = require('assert'); | |
const R = require('ramda') | |
PouchDB.plugin(require('crypto-pouch')); | |
// Create a temporary directory | |
var tmpobj = tmp.dirSync(); | |
let dbLoc = `${tmpobj.name + '/mydb'}` | |
console.log(`dbLoc = ${dbLoc}`) |
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
14ww3NG4sotUQdJGttBGuuZqkgaG9f7ran https://explorer.blockstack.org/address/14ww3NG4sotUQdJGttBGuuZqkgaG9f7ran |
OlderNewer