Skip to content

Instantly share code, notes, and snippets.

@dloman
dloman / sshpiperadd.bash
Last active August 5, 2022 21:27
sshpiper add
#!/usr/bin/bash
if [ $1="-h" ]; then
echo "USAGE: sshpiperadd.bash \$NAME \$USERNAME \$IP "
exit
fi
if [ "$#" -ne 4 ]; then
echo "USAGE: sshpiperadd.bash \$NAME \$USERNAME \$IP "
exit
@dloman
dloman / any
Created May 31, 2018 07:10
simple any implementation
#include <iostream>
#include <memory>
#include <typeinfo>
struct bad_any_cast
{
};
class any
{
<!DOCTYPE html>
<meta charset="utf-8" />
<title>WebSocket Test</title>
<script language="javascript" type="text/javascript">
var wsUri = "wss://localhost:8181/";
var output;
function init()
{
@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

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 / 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
#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);
#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))
@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")
#!/usr/bin/python
import web
import json
urls = ('/(.*)', 'hello')
app = web.application(urls, globals())
###############################################################################
###############################################################################