Document Number: | P1143r3 |
---|---|
Date: | 2019-06-18 |
Project: | Programming Language C++, Evolution |
Revises: | P1143r2 |
Reply to: | eric@efcs.ca |
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
#!/usr/bin/env python3 | |
""" | |
Show and adjust display parameters on an Iiyama ProLite XB2483HSU-B1 monitor | |
Requirements: | |
- mentioned monitor (27' should also work) with DDC/CI setting on | |
- Windows Vista+ | |
- Python 3 |
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
# Simple Wrapper around XInput API | |
# | |
# Author: David Coles <coles.david@gmail.com> | |
import ctypes | |
from ctypes.wintypes import BYTE, WORD, SHORT, DWORD | |
class XInputGamepad(ctypes.Structure): | |
_fields_ = [ |
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
git submodule foreach --recursive git reset --hard | |
git reset --hard | |
git submodule update --init | |
git submodule foreach --recursive git submodule update --init |
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 application import db | |
from application.views.modelview import ModelView | |
from application.models import Things # has an attribute called thing_type | |
class MyModelView(ModelView): | |
def get_query(self): | |
thing_type = request.args.get('type', None) # pretending we have a GET parameter called "type" | |
if thing_type == "type1": | |
return super(ModelView, self).get_query().filter(Things.thing_type.like('type1 %')) | |
elif thing_type == "type2": |
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 <cstdlib> | |
#include <iostream> | |
#include <chrono> | |
#include <random> | |
#include<gsl/gsl_rng.h> | |
class Timer | |
{ | |
private: |
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 pytz | |
class MyView(MyModelView): | |
# Display the time in user's local timezone on the List View | |
column_formatters = | |
dict(scheduledtime=lambda v,c,m,p: m.scheduledtime.replace(tzinfo=pytz.utc).astimezone(tz=pytz.timezone(config.LOCAL_TIMEZONE))) | |
# Display the time in user's timezone on the Edit View | |
def edit_form(self, obj): | |
form = self._edit_form_class(get_form_data(), obj=obj) |
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 wtforms import SelectField | |
import pycountry | |
class CountrySelectField(SelectField): | |
def __init__(self, *args, **kwargs): | |
super(CountrySelectField, self).__init__(*args, **kwargs) | |
self.choices = [(country.alpha_2, country.name) for country in pycountry.countries] |
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 <thrust/device_vector.h> | |
#include <thrust/random.h> | |
struct GenRand | |
{ | |
__device__ | |
float operator () (int idx) | |
{ | |
thrust::default_random_engine randEng; | |
thrust::uniform_real_distribution<float> uniDist; |
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
def truncate_db(engine): | |
# delete all table data (but keep tables) | |
# we do cleanup before test 'cause if previous test errored, | |
# DB can contain dust | |
meta = MetaData(bind=engine, reflect=True) | |
con = engine.connect() | |
trans = con.begin() | |
con.execute('SET FOREIGN_KEY_CHECKS = 0;') | |
for table in meta.sorted_tables: | |
con.execute(table.delete()) |
OlderNewer