This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function parseInterval(s) { | |
| var matches = new RegExp("^expire-([0-9]+)([mhdDwM])$").exec(s); | |
| if (!matches) { | |
| return null; | |
| } | |
| var count = parseInt(matches[1]); | |
| var unit = matches[2]; | |
| var date = new Date(); | |
| switch (unit) { | |
| case "M": |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [brightness] | |
| label=BRI | |
| command=/home/maat/.i3/brightness | |
| interval=5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class IP4(object): | |
| """ | |
| >>> print IP4("10.150.42.23") & IP4("255.255.0.0") | IP4("0.0.255.254") | |
| 10.150.255.254""" | |
| def __init__(self, s="0.0.0.0"): | |
| s = str(s) | |
| self.ip = [int(i) for i in s.split(".")] | |
| assert len(self.ip) == 4 | |
| assert all(0 <= i <= 255 for i in self.ip) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| wut () { | |
| case "$1" in | |
| full|terse|mixed|changes|filter) so=$1; shift ;; | |
| v|verbose|-v) so=full; shift ;; | |
| esac | |
| job=$(salt-run jobs.list_jobs --out=json | | |
| jq -r '[to_entries[]|select(.value|.Function|contains("state")).key]|max') | |
| salt-run --force-color --out=highstate --state-output=${so:-full} \ | |
| "$@" jobs.lookup_jid $job |& less -r | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://codeload.github.com/niesteszeck/idDHT11/zip/master | |
| #include "DHT.h" | |
| DHT dht; | |
| void setup() | |
| { | |
| Serial.begin(9600); | |
| Serial.println(); | |
| Serial.println("Pin\tStatus\tHumidity (%)\tTemperature (C)"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sl: | |
| pkg.installed | |
| xinetd: | |
| pkg: | |
| - installed | |
| service.running: | |
| - require: | |
| - pkg: xinetd | |
| - watch: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [ -z "$1" -o ! -f "$1" ]; then | |
| echo Usage: $0 pkcs-file-name | |
| exit 1 | |
| fi | |
| openssl pkcs12 -in "$1" -nodes -out /dev/stdout |awk '/BEGIN/,/END/' | bash $(dirname $0)/sortchain.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| from optparse import OptionParser | |
| from subprocess import check_call | |
| def main(): | |
| parser = OptionParser("usage: %prog [options] fqdn") | |
| parser.add_option("-d", "--dry-run", | |
| action="store_true", dest="dry_run") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /usr/local/sbin/rescan-scsi: | |
| file.managed: | |
| - mode: 755 | |
| - contents: | | |
| #!/bin/bash | |
| echo Before: | |
| awk '/sd/{print $4, int(int($3)/1024/1024) "G"}' /proc/partitions | |
| # find new devices | |
| echo "- - -" | tee /sys/class/scsi_host/host*/scan | |
| # rescan disk sizes (detect extension) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| service beep | |
| { | |
| flags = REUSE | |
| socket_type = stream | |
| wait = no | |
| user = root | |
| server = /usr/local/bin/beep.sh | |
| server_args = -l 400 | |
| disable = no | |
| } |
NewerOlder