Skip to content

Instantly share code, notes, and snippets.

View Theodore-Rose's full-sized avatar

Theo Rose Theodore-Rose

  • compass
View GitHub Profile
@Theodore-Rose
Theodore-Rose / user_model.py
Created February 10, 2020 21:51
User model
@uc_schema_mixin
class User(UcDocument, BaseUcFlaskUserMixin):
email = LowercasingEmailField(unique=True)
password = StringField(max_length=255)
active = BooleanField(default=True)
confirmed_at = DateTimeField()
last_login_at = DateTimeField()
current_login_at = DateTimeField()
# The last time when this use was active. This is stored with millis accuracy but is
# computed with a lower accuracy (currently day).
@Theodore-Rose
Theodore-Rose / .go
Last active September 7, 2020 15:12
Adding memory profile
func writeHeap() {
log.Info("Writing profiles")
resp, err := http.Get("http://localhost:8024/debug/pprof/heap")
if err != nil {
log.Infof("Failed at http.Get error: %+v", err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)