Skip to content

Instantly share code, notes, and snippets.

ifconfig| grep 'inet ' | /usr/bin/grep -o -E '([0-9]{1,3}\.){3}[0-9]{1,3}'
nslookup -query=aaaa domain-v6.xxx.com
or
host domain-v6.xxx.com
#!/usr/bin/perl -w
use strict;
#
my $commit = "";
my $cc = $ARGV[0];
my $up_branch = "up_branch";
chdir "./adaptation_resilience";
import sys,os,subprocess
def get_file_mode_change (branch1, branch2):
cmd = 'git diff --summary ' + branch1 + '..' + branch2 + ' | grep "mode change" | ' + " awk '{ print $6 }' "
output = subprocess.check_output (cmd, shell=True)
return output.splitlines()
def get_file_deleted (branch1, branch2):
cmd = 'git diff --name-status ' + branch1 + '..' + branch2 + ' | grep "^D" | ' + " awk '{ print $2 }' "
# print the line contains the expression
perl -ne 'print if /expression/' xxx.log
# print some capture datea
perl -ne 'print "$1\n" if /aaa=(\d+)\s.*/' xxx.log
ssh-copy-id user@remote_server
# or
cat ~/.ssh/id_rsa.pub | ssh username@host "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"