Skip to content

Instantly share code, notes, and snippets.

@boustrophedon
boustrophedon / run.py
Last active September 21, 2016 12:51
database query runner/logger for 336
import sys
import subprocess
# Helper script for 336
#
# Usage: python run.py [queryfile] [outputfile]
#
# Parameters:
# queryfile: A text file with a list of queries, one per line, to run on the server. Default is queries.txt
# outputfile: The output of the queries. Default is output.txt
@boustrophedon
boustrophedon / playground.rs
Created November 3, 2016 22:01 — forked from anonymous/playground.rs
Shared via Rust Playground
struct Thing {
pub num: i32,
}
impl Thing {
pub fn new(n: i32) -> Thing {
Thing { num: n }
}
pub fn add_total(&mut self, things: &ThingContainer) {
extern crate nalgebra;
#[macro_use] extern crate glium;
use glium::{DisplayBuild, Surface};
use nalgebra::{PerspectiveMatrix3, Vector3, Matrix4, Point3, Isometry3, ToHomogeneous};
#[derive(Clone, Copy, Debug)]
struct Vert {
position: [f32;3],
}
def infinite_generator():
x = 0
while True:
x += 1
yield x # when we hit this we basically are returning a generator object
def main():
my_generator = infinite_generator()
print(next(my_generator)) # 1
print(next(my_generator)) # 2
>>> import dis
>>> def f(x):
... print(x+2)
...
>>> dis.dis(f)
2 0 LOAD_GLOBAL 0 (print)
2 LOAD_FAST 0 (x)
4 LOAD_CONST 1 (2)
6 BINARY_ADD
8 CALL_FUNCTION 1
Compiling clippy_lints v0.0.131
error[E0107]: wrong number of lifetime parameters: expected 0, found 1
--> .cargo/registry/src/github.com-1ecc6299db9ec823/clippy_lints-0.0.131/src/loops.rs:878:35
|
878 | indexed: HashMap<Name, Option<CodeExtent<'tcx>>>, // indexed variables, the extent is None for global
| ^^^^^^^^^^^^^^^^ unexpected lifetime parameter
error: aborting due to previous error
error: Could not compile `clippy_lints`.
Computer Information:
Manufacturer: Unknown
Model: Unknown
Form Factor: Desktop
No Touch Input Detected
Processor Information:
CPU Vendor: GenuineIntel
CPU Brand: Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz
CPU Family: 0x6
@boustrophedon
boustrophedon / assertion_failure.dart
Created August 18, 2017 23:35
Assertion failure in gesture handling
I/flutter (23776): ══╡ EXCEPTION CAUGHT BY GESTURE ╞═══════════════════════════════════════════════════════════════════
I/flutter (23776): The following assertion was thrown while handling a gesture:
I/flutter (23776): 'package:flutter/src/widgets/scrollable.dart': Failed assertion: line 425: '_hold != null': is not
I/flutter (23776): true.
I/flutter (23776):
I/flutter (23776): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (23776): more information in this error message to help you determine and fix the underlying cause.
I/flutter (23776): In either case, please report this assertion by filing a bug on GitHub:
I/flutter (23776): https://github.com/flutter/flutter/issues/new
I/flutter (23776):
@boustrophedon
boustrophedon / output
Created August 18, 2017 23:39
Warnings and errors from flutter analyze
Analyzing 1157 files...
[warning] The method 'encodePng' isn't defined for the class 'Upload'. (/home/hcs/code/flutter/dev/devicelab/lib/tasks/save_catalog_screenshots.dart, line 83, col 20)
[warning] The method 'decodePng' isn't defined for the class 'Upload'. (/home/hcs/code/flutter/dev/devicelab/lib/tasks/save_catalog_screenshots.dart, line 83, col 41)
[warning] The method 'copyResize' isn't defined for the class 'Upload'. (/home/hcs/code/flutter/dev/devicelab/lib/tasks/save_catalog_screenshots.dart, line 83, col 30)
[error] Target of URI doesn't exist: 'package:image/image.dart'. (/home/hcs/code/flutter/dev/devicelab/lib/tasks/save_catalog_screenshots.dart, line 10, col 8)
[lint] 1 public member lacks documentation (ran in 29.5s)
@boustrophedon
boustrophedon / vartest.cpp
Last active April 4, 2018 00:40
g++ -std=c++17 vartest.cpp -o vartest && ./vartest; echo $?
#include <variant>
#include <string>
#include <cassert>
using std::string;
int main() {
std::variant<bool, string> v = "hello";
try {