Skip to content

Instantly share code, notes, and snippets.

View fregmented's full-sized avatar
🌌

HanWool Lee fregmented

🌌
View GitHub Profile
@rounakdatta
rounakdatta / esp32_ota_stm32.ino
Created September 6, 2019 19:43
Flash STM32 firmware from ESP32
#include <SPIFFS.h>
/*
*
* Copyright (C) 2017 CS.NOL https://github.com/csnol/1CHIP-Programmers
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License,
* and You have to keep below webserver code
@khannedy
khannedy / ESCPrinter.java
Created August 30, 2015 04:29
Very simple lightweight library to print to Epson ESC/P and ESC/P2 matrix printers from Java
/*
Copyright (c) 2006-2007, Giovanni Martina
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that
the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
@hest
hest / gist:8798884
Created February 4, 2014 06:08
Fast SQLAlchemy counting (avoid query.count() subquery)
def get_count(q):
count_q = q.statement.with_only_columns([func.count()]).order_by(None)
count = q.session.execute(count_q).scalar()
return count
q = session.query(TestModel).filter(...).order_by(...)
# Slow: SELECT COUNT(*) FROM (SELECT ... FROM TestModel WHERE ...) ...
print q.count()