diff --git a/bin.org b/bin.org index 293e07e..756680a 100644 --- a/bin.org +++ b/bin.org @@ -980,74 +980,6 @@ if ($valid){ exit 0; #+END_SRC -* ~/bin/portchk - -Just find out if a port responds to anything tcp related or not. - -#+BEGIN_SRC perl :padline no :tangle tmp/bin/portchk -#!/usr/bin/env perl -# -# Dumb wrapper to get the gecos information from a uid/username. - -foreach my $input (@ARGV){ - my $gecos = undef; - my $uid = undef; - my $name = undef; - if ( $input =~ m/^\d+$/ ) { - ( $name,$uid,$gecos ) = ( getpwuid($input) )[0,2,6]; - } else { - ( $name,$uid,$gecos ) = ( getpwnam($input) )[0,2,6]; - } - print "$name is '$gecos' uid '$uid'\n" if $gecos; -} -#+END_SRC - -* TODO ~/bin/nix-update still worth keeping? :cleaning: - -More for nix on macos, but just merges NixOS/nipkgs origin/master to the current branch in a tmux window and watches it. - -#+BEGIN_SRC sh :padline no :tangle (tangle/file "bin/nix-update" (bound-and-true-p nix-p)) :mkdirp t -#!/usr/bin/env sh -#-*-mode: Shell-script; coding: utf-8;-*- -# File: tmux-nix.sh -# Copyright: 2017 Mitch Tishmack -# Description: instantiate tmux nix session -export script=$(basename "$0") -export dir=$(cd "$(dirname "$0")"; pwd) -export iam=${dir}/${script} -set -e - -session=nix -PKGS=${PKGS:-nixpkgs} - -if "${PKGS}" != "nixpkgs"; then - cd ~/src/github.com/NixOS/nixpkgs/${PKGS} -else - cd ~/src/github.com/NixOS/nixpkgs -fi - -if ! tmux has-session -t ${session}; then - tmux new-session -d -s ${session} -n nix - tmux send-keys -t ${session}:0 'sleep 30 -while true; do -blah=$(nix-env -f "<${PKGS}>" -iA --dry-run stdboth default | grep /nix); echo "${blah}" | head -n $(echo "$LINES - 2" | bc); echo "${blah}" | grep -c /nix | ts -echo "${blah}" | grep /nix > /dev/null 2>&1 -if [ $? -eq 0 ]; then - sleep 60 - clear -else - exit 0 -fi -done -' C-m - tmux split-window -v -t ${session}:0 - tmux send-keys -t ${session}:0.1 'git fetch --all && git short HEAD > last-$(iso8601) && git rebase --autostash origin/staging && -time nix-env -f "<${PKGS}>" -iA default && nix-env -f "<${PKGS}>" -u --leq && exit 0 -' C-m - tmux select-window -t ${session}:0 -fi -tmux attach -t ${session} -#+END_SRC * ~/bin/notify OSX only really, just fires off a notification when its ran. @@ -1056,53 +988,25 @@ Example: notify "some command" "not ok" First param is the message, second title of the notification. -#+BEGIN_SRC sh :padline no :tangle (tangle/file "bin/notify" (bound-and-true-p macos-p)) +#+BEGIN_SRC sh :padline no :tangle (tangle/file "bin/notify" (bound-and-true-p macos-p)) :mkdirp t #!/bin/sh -message=${1:="no message"} -title='' -if [ "${2}" != "" ]; then - message="${2}" - title="${1}" +message=${1:-"no message"}; shift +extra="" +if [ -n "${1}" ]; then + extra="with title \"${1}\"" fi -notification="display notification \"${message}\"" -[ "${title}" != "" ] && notification="${notification} with title \"${title}\"" -osascript -e "${notification}" +osascript <