Skip to content

Instantly share code, notes, and snippets.

@prasad83
prasad83 / imapserver.py
Last active May 30, 2025 12:45 — forked from qistoph/imapserver.py
Simple IMAP server for testing purposes. Copied from bamthomas. Added SSL
#!/usr/bin/python3
# https://raw.githubusercontent.com/bamthomas/aioimaplib/master/aioimaplib/tests/imapserver.py
# aioimaplib : an IMAPrev4 lib using python asyncio
# Copyright (C) 2016 Bruno Thomas
#
# 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, or
# (at your option) any later version.
@prasad83
prasad83 / in_array.go
Last active January 3, 2021 18:25 — forked from kn9ts/in_array.go
// Function to check if the the string given is in the array
inArray := func(str string, list []string) bool {
// early exit if list is nil
if list == nil {
return false
}
for _, v := range list {
if v == str {
return true
}
@prasad83
prasad83 / gist:ec49d63ae3e7d29b25bbd1974a34b602
Created March 15, 2017 19:15 — forked from ryanwitt/gist:2911560
Confusion matrix for a logistic glm model in R. Helpful for comparing glm to randomForests.
confusion.glm <- function(data, model) {
prediction <- ifelse(predict(model, data, type='response') > 0.5, TRUE, FALSE)
confusion <- table(prediction, as.logical(model$y))
confusion <- cbind(confusion, c(1 - confusion[1,1]/(confusion[1,1]+confusion[2,1]), 1 - confusion[2,2]/(confusion[2,2]+confusion[1,2])))
confusion <- as.data.frame(confusion)
names(confusion) <- c('FALSE', 'TRUE', 'class.error')
confusion
}
@prasad83
prasad83 / schema.xml
Created March 12, 2012 05:05 — forked from jeremy/schema.xml
Basecamp Solr schema
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="basecamp" version="1.3">
<types>
<!-- indexed/stored verbatim -->
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true" omitTermFreqAndPositions="true"/>
<!-- "true" or "false" -->
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true" omitTermFreqAndPositions="true"/>
<!-- binary data, base64 -->
@prasad83
prasad83 / jquery.bootstrap.confirm.popover.js
Created February 22, 2012 20:24 — forked from dgorissen/jquery.bootstrap.confirm.popover.js
Confirmation dialog using jQuery and Bootstrap
/*
Copyright (c) 2011 Damien Antipa, http://www.nethead.at/, http://damien.antipa.at
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions: