e.g.
def is_json(filename):
return filename.endswith(".json")
starts = ['X:\\configs', 'X:\\todo']
d = DirectoryIterator(starts, is_json)
| import json | |
| import ast | |
| from codecs import encode, decode | |
| with open("CFFFP_Drawer_ThinHandle_TOLERANT.gcode", "r", encoding="utf-8") as f: | |
| settings_lines = [ | |
| line.strip()[11:] for line in f.readlines() if line.startswith(";SETTING_3 ") | |
| ] | |
| data = json.loads("".join(settings_lines)) |
| from cachecontrol import CacheControl | |
| from cachecontrol.caches import FileCache | |
| from cachecontrol.heuristics import BaseHeuristic | |
| class NoImagesHeuristic(BaseHeuristic): | |
| def update_headers(self, response): | |
| if response.headers['Content-Type'].startswith("image/"): | |
| return { | |
| 'cache-control': 'no-cache', | |
| } |
| #!/usr/bin/awk -f | |
| # mailto:jlb@research.bell-labs.com | |
| function error(s) | |
| { | |
| print "dformat error: " s " near input line " NR | "cat 1>&2"; | |
| } | |
| BEGIN { | |
| s= "recht 0.3 addrht 0.055 recspread 0.15 "; |
| using UnityEngine; | |
| using System.Collections; | |
| public class MapLoader : MonoBehaviour | |
| { | |
| public GameObject floor; | |
| bool IsBitSet (byte b, int pos) |
| #!/bin/sh | |
| interfaces=$(firewall-cmd --info-zone=internal | grep interfaces | cut -d' ' -f 4-) | |
| for a in $interfaces; do | |
| for b in $interfaces; do | |
| if [ $a != $b ]; then | |
| echo "$a to $b" | |
| firewall-cmd --permanent --direct --add-rule ipv4 filter FWDI_internal_allow 0 -o $a -i $b -j ACCEPT |
| # missing all the `exit`s | |
| scope eth-uplink | |
| create vlan VLAN-20 20 | |
| commit-buffer | |
| scope org / | |
| create org USER-POD-2 | |
| commit-buffer |
| controls: | |
| - children: | |
| - commands: | |
| - G12 P1 S4 | |
| name: Clean | |
| type: command | |
| - commands: | |
| - G27 | |
| name: Park | |
| type: command |
| // Taken almost verbatim from https://gist.github.com/bfocht/a0def4432d0f93dc28bc7cf64ebe8be1 | |
| // copy the just-built js code into the place weathermap/cacti expect to find it | |
| const fs = require('fs'); | |
| const src = './build/'; | |
| const dest = '../../cacti-resources/user/'; | |
| const targets = ["main.js", "main.css"]; |
| #!/usr/bin/perl | |
| # Cheezy perl script to produce the typeset Unix manual, as ken intended. | |
| # | |
| # Gets a list of every manpage from man(1), and compile them into per-section PDF files in the final/ subdir | |
| # Pulls the intro page to the front of each section, if there is one. | |
| # Also leaves the individual PDF pages in the various man* subdirs | |
| # | |
| # Assumptions: you have groff and ghostscript installed. I think you will need to run makewhatis, too. | |
| # |