Skip to content

Instantly share code, notes, and snippets.

@surt91
surt91 / scan_dids.py
Created October 20, 2023 16:09
scan_dids
import time
import udsoncan
from udsoncan.connections import IsoTPSocketConnection
from udsoncan.client import Client
from udsoncan.services import ReadDataByIdentifier
interface = "can0"
txid = 0x6C5
rxid = txid + 0x10
#!/usr/bin/env python3
import os
import sys
if len(sys.argv) != 2:
print("expect exactly one argument: filename to commands")
sys.exit(1)
filename = sys.argv[1]
@surt91
surt91 / cloudSettings
Last active May 11, 2021 16:56
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-05-11T16:56:26.202Z","extensionVersion":"v3.4.3"}
// ============================================================================
// gzstream, C++ iostream classes wrapping the zlib compression library.
// Copyright (C) 2001 Deepak Bandyopadhyay, Lutz Kettner
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
@surt91
surt91 / SAT.cpp
Last active November 19, 2018 20:05
#include "SAT.hpp"
/// Constructs an random K-SAT instance
SAT::SAT(int N, int M, int k, std::mt19937 &rng)
: clauses(M),
N(N),
M(M),
k(k)
{
std::uniform_int_distribution<int> uniform(1, N);
#include "Logging.hpp"
bool Logger::quiet = false; ///< Log only to file or also to stdout
int Logger::verbosity = 0; ///< global verbosity level to use
std::string Logger::logfilename = ""; ///< Filename to write the messenges to
Logger::Logger(log_level_t level, std::string file, int line, std::string function)
: level(level),
ss(),
file(file),
@surt91
surt91 / jsnake.html
Last active September 3, 2017 08:45
A simple snake clone. Try it at [TODO]
<!doctype html>
<div>
<h1>jsnake</h1>
<canvas id="jsnake"></canvas>
<p>
Steer with WSAD and have some fun!
</p>
@surt91
surt91 / .gitignore
Last active October 8, 2017 12:00 — forked from bbengfort/nx2gt.py
Convert a networkx to graph-tool graph
__pycache__
@surt91
surt91 / gzstream.h
Last active December 15, 2016 15:07 — forked from piti118/gzstream.h
Header-only version of gzstream
// ============================================================================
// gzstream, C++ iostream classes wrapping the zlib compression library.
// Copyright (C) 2001 Deepak Bandyopadhyay, Lutz Kettner
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
#!/usr/bin/env python3
import sys
from random import random
import networkx as nx
def updateAliveNeighbors(G, changedNodes, alive_neighbors):
for n in set(changedNodes):
alive_neighbors[n] = 0