Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 <string> | |
| #include <boost/thread.hpp> | |
| #include <boost/asio.hpp> | |
| #define N_THREADS 4 | |
| #define N_JOBS 10 | |
| /* compile on Ubuntu using | |
| g++ par.cpp -lboost_thread -lboost_system |
This file contains hidden or 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 sqlalchemy.ext.declarative import declarative_base | |
| from sqlalchemy import Column, String, Integer, Numeric | |
| from sqlalchemy.orm import backref, relationship | |
| Base = declarative_base() | |
| class Thing(Base): | |
| __tablename__ = 'things' | |
| id = Column(Integer, primary_key=True) |
This file contains hidden or 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 flask import Flask, Response | |
| app = Flask(__name__) | |
| @app.route('/') | |
| def index(): | |
| return Response('<h1>Hello, world.</h1>',mimetype='text/html') | |
| if __name__=='__main__': | |
| app.run(host='0.0.0.0',port=8080,debug=True) |
This file contains hidden or 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 pandas import DataFrame, merge | |
| import numpy as np | |
| # generate array of random small integers | |
| df1 = DataFrame(np.random.random_integers(5,size=(5,2)),columns=['a','b']) | |
| # find unique values | |
| uq = df1.a.unique() | |
| # now generate two associated columns per unique value |
This file contains hidden or 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
| # Name: Makefile | |
| # Author: <insert your name here> | |
| # Copyright: <insert your copyright message here> | |
| # License: <insert your license reference here> | |
| # This is a prototype Makefile. Modify it according to your needs. | |
| # You should at least check the settings for | |
| # DEVICE ....... The AVR device you compile for | |
| # CLOCK ........ Target AVR clock rate in Hertz | |
| # OBJECTS ...... The object files created from your source files. This list is |
This file contains hidden or 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
| ECHO OFF | |
| cd /d %~dp0 | |
| for /f "tokens=2* delims= " %%F IN ('vagrant status ^| find /I "default"') DO (SET "STATE=%%F%%G") | |
| ECHO Close this window if it remains open, and http://localhost:8081 is responsive | |
| IF "%STATE%" NEQ "saved" ( | |
| ECHO Starting Vagrant VM from powered down state... | |
| vagrant up | |
| ) ELSE ( |
This file contains hidden or 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 random | |
| import shutil | |
| import tempfile | |
| import os | |
| from oii.utils import retry, safe_tempdir, gen_id, compare_files | |
| def unreliable_copy(src,dest): | |
| if random.random() > 0.2: | |
| shutil.copy(src,dest) |
This file contains hidden or 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 oii.ldr import Resolver | |
| RESOLVER=""" | |
| <rule name="main"> | |
| <path var="conf_file" match="/etc/*/*.conf"/> | |
| </rule> | |
| """ | |
| # load the resolver from the text block. | |
| # you can also pass a filename to Resolver |
This file contains hidden or 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
| Vagrant.configure("2") do |config| | |
| config.vm.box = "ubuntu/trusty64" | |
| config.vm.provider "virtualbox" do |vb| | |
| vb.memory="2048" | |
| end | |
| end |