Skip to content

Instantly share code, notes, and snippets.

@dloman
dloman / gist:7011907
Created October 16, 2013 17:47
Python script for getting number of new messages on an exchange server
#!/usr/bin/python
##Gets Number of New Emails
##Daniel Loman 10/15/2013
import getpass, imaplib, pickle
########################################################################################
########################################################################################
def GetNumberOfMessages():
Mailbox = imaplib.IMAP4("server.address")
AuthenticationToken = pickle.load(open(AuthFileLocation,'rb'))
Mailbox.authenticate("NTLM", AuthenticationToken)
@dloman
dloman / quadrature rotary encoder
Created October 16, 2013 21:47
quadrature encoder -> servo
#include <Servo.h>
Servo MyServo;
void setup()
{
// encoder pin on interrupt 0 (pin 2)
attachInterrupt(0, encoderPinChangeA, CHANGE);
// encoder pin on interrupt 1 (pin 3)
attachInterrupt(1, encoderPinChangeB, CHANGE);
@dloman
dloman / xvfb
Last active September 12, 2023 12:32 — forked from jterrace/xvfb
### BEGIN INIT INFO
# Provides: Xvfb
# Required-Start: $local_fs $remote_fs
# Required-Stop:
# X-Start-Before:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Loads X Virtual Frame Buffer
### END INIT INFO
#!/usr/bin/python
import web
import json
urls = ('/(.*)', 'hello')
app = web.application(urls, globals())
###############################################################################
###############################################################################
@dloman
dloman / BokehPlot.py
Created September 30, 2015 08:22
This takes data from random input or from a temperature server and sends it to a bokeh plot server
import argparse
import numpy as np
import serial
import time
from bokeh.plotting import figure, output_server, cursession, show
from Instrulab import Instrulab
output_server("Temperature Plot")
#define TEST_VAR
#define VALUE_TO_STRING(x) #x
#define VALUE(x) VALUE_TO_STRING(x)
#define VAR_NAME_VALUE(var) #var "=" VALUE(var)
/* Some example here */
#pragma message(VAR_NAME_VALUE(TEST_VAR))
#include <iostream>
#include <chrono>
using namespace std;
int main()
{
typedef chrono::duration<unsigned long, milli> milliseconds_t;
typedef chrono::duration<unsigned long> seconds_t;
milliseconds_t Milliseconds(11111);
@dloman
dloman / xvfb.service
Last active April 22, 2022 23:12
sytemd xvfb
[Unit]
Description=X Virtual Frame Buffer Service
After=network.target
[Service]
ExecStart=/usr/bin/Xvfb :1 -screen 0 1024x768x24 -ac +extension GLX +render -noreset
[Install]
WantedBy=multi-user.target
std::mutex Mutex;
std::condition_variable cv;
std::unique_lock<std::mutex> Lock(Mutex);
for (auto i = 0; i < 10; ++i)
{
auto a = cv.wait_for(Lock, std::chrono::milliseconds(10));
if (a == std::cv_status::no_timeout)
{
return 1;
@dloman
dloman / SBHXCommunityGuidelines.md
Last active December 7, 2017 00:57
SBHX Community Guidelines

Hi Santa Barbara Hackerspace community and members. We’re now into our sixth year of existence and have grown significantly in that time thanks to you all. As part of that growth we are setting forth some Community Guidelines to help make the space even better. We will be posting this document to sbhackerspace.com/membership. These guidelines are a living document and will be amended and revised as necessary.

TL;DR: Please clean up after yourself, the space does not have a janitor. Everyone can do their small part and help keep the space and equipment safe, clean, and useable. If a member fails to do this bad things will happen (we may throw their stuff away, yell at them, or they could lose their membership).

Trash

There are no janitors at the space sotrash cans are taken out by members who want to help out.. If you see a full trash can and want to help keep the space clean, please help out and empty it in the tan dumpster outside. The tan dumpster and blue recycling bin are the space’s refuse repos