Skip to content

Instantly share code, notes, and snippets.

@foofoodog
foofoodog / Dockerfile
Last active Jul 6, 2019
steamcmd rust server
View Dockerfile
from ubuntu as patched
run apt-get update; \
apt-get install software-properties-common apt-utils debconf-utils -y; \
apt-get install --reinstall ca-certificates; \
add-apt-repository multiverse; \
dpkg --add-architecture i386; \
apt-get update;
from patched as steamcmd
copy rust.sh .
View AsParallel.linq.cs
async Task Main()
{
Action<WorkItem> actionItem = (WorkItem w) => w.DoWork();
var jobs = (from x in Enumerable.Range(1, 64)
let workItem = new WorkItem() { Id = x }
select new ActionItem<WorkItem>()
{
item = workItem,
action = (t) => actionItem(t)
}).ToList();
View asp.net.core.ng.dockerfile
# REF https://www.talkingdotnet.com/how-to-create-an-angular-6-app-with-visual-studio-2017/
# REF https://docs.docker.com/engine/examples/dotnetcore/#build-and-run-the-docker-image
FROM microsoft/dotnet:sdk AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN apt-get update; \
apt-get install -y gnupg gnupg2 gnupg1; \
@foofoodog
foofoodog / -node-red with dashboard and mosquitto in alpine docker.md
Last active Apr 7, 2018
node-red with dashboard and mosquitto in alpine docker
View -node-red with dashboard and mosquitto in alpine docker.md

node-red with dashboard and mosquitto in alpine docker

Cmd wrapper around docker commands to build and run an IoT dashboard kind of thing. Tries to do the right thing:

  • Create the image if it does not exist then run the container.
  • Run the container if it does not exist and the image does.
  • Start the container if it exists and is stopped.
Usage: node-red-local [clean]
    clean: Remove container and image to start from scratch. Note that all flows and dashboard items will be lost.
@foofoodog
foofoodog / dl.cmd
Created Mar 28, 2018
youtube-dl as a linux docker on windows
View dl.cmd
@echo off
if %1.==. goto err
docker build -q -t utube . > nul
docker run --rm -v"%cd%":/data -e url="%*" utube
goto :eof
:err
echo needs 1 url arg
@foofoodog
foofoodog / index.htm
Last active May 7, 2016
OctoPrint monitoring starter
View index.htm
<html>
<head>
<script>
var printers = [
{name: "folger", key: "raspberry"},
{name: "simple", key: "raspberry"},
{name: "solid", key: "raspberry"},
{name: "printrbot", key: "raspberry"}
];
</script>
View egg.stl
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@foofoodog
foofoodog / App.js
Last active Nov 15, 2015
octoprint client libs
View App.js
var App = function(ready) {
var self = this;
self.config = {
options : {baseurl: "http://localhost:5000", apikey:"raspberry"},
scripts: ["/static/webassets/packed_libs.js", "/static/webassets/packed_client.js"]
};
self.load = function(idx) {
idx = idx || 0;
if (idx === self.config.scripts.length) return self.done();
var tag = document.createElement("script");
@foofoodog
foofoodog / folger toc.linq
Last active Sep 20, 2015
LINQPad to parse specific github README.md and generate reddit markdown TOC
View folger toc.linq
var readme = "https://github.com/cyberkni/FolgertechManuals/blob/master/2020i3/README.md";
var includes = new[] { "id=\"user-content-", "href=\"#" };
var excludes = new[] { "<article" };
// input
IEnumerable<XElement> elements;
using (var client = new WebClient())
{
elements = from line in client.DownloadString(readme).Split('\n')
where
includes.All(include => line.Contains(include))
@foofoodog
foofoodog / nuke.cmd
Last active Aug 29, 2015
Rip and replace OctoPrint
View nuke.cmd
#!/usr/bin/env bash
cd ~
sudo service octoprint stop
sudo rm -Rf OctoPrint
sudo rm -Rf .octoprint
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install python-pip python-dev python-setuptools python-virtualenv git libyaml-dev
git clone https://github.com/foosel/OctoPrint.git
cd OctoPrint
You can’t perform that action at this time.