Skip to content

Instantly share code, notes, and snippets.

View exec_parallel.py
#!/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
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2021-05-11T16:56:26.202Z","extensionVersion":"v3.4.3"}
View gzstream.h
// ============================================================================
// 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,
View SAT.cpp
#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);
View Logging.cpp
#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 Sep 3, 2017
A simple snake clone. Try it at [TODO]
View jsnake.html
<!doctype html>
<div>
<h1>jsnake</h1>
<canvas id="jsnake"></canvas>
<p>
Steer with WSAD and have some fun!
</p>
@surt91
surt91 / .gitignore
Last active Oct 8, 2017 — forked from bbengfort/nx2gt.py
Convert a networkx to graph-tool graph
View .gitignore
__pycache__
@surt91
surt91 / gzstream.h
Last active Dec 15, 2016 — forked from piti118/gzstream.h
Header-only version of gzstream
View gzstream.h
// ============================================================================
// 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,
View cellularMaze.py
#!/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
@surt91
surt91 / plot.py
Created Sep 16, 2016
Solving and plotting the Lorenz Attractor
View plot.py
#!/usr/bin/env python3
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt
if __name__ == "__main__":
with open("lorenz.txt","r",encoding='utf-8') as f:
tmp=[i.split(" ") for i in f.readlines()]