perl -pe 's/^(.+)\/([^\s]+)\-([v0-9.]+)\-*([Final|GA|M2|rc|beta|R5]*).jar$/$2\t$3\t$4/'
Showing posts with label cli. Show all posts
Showing posts with label cli. Show all posts
Monday, 27 August 2018
Wednesday, 28 May 2014
Zenoss: CLI discovery and remodel
Become zenoss user 1st
su - zenossRemodel a bunch
for i in server1 server2 server3;do zenmodeler run --now -d $i;doneDiscover a bunch
for i in server1 server2 server3;do zendisc run --deviceclass=/Server/Linux --device=$i;doneFriday, 6 December 2013
aws ec2 cli filter by tag name and value
- aws ec2 describe-instances --filter Name=tag:Name,Values=ADS-prod-ads
- aws ec2 describe-instances
- --filter
- '{"Name":"tag:backup","Values":["yes"]}'
- '{"Name":"instance-state-name","Values":["running"]}'
- non-breakout view below
aws ec2 describe-instances --filter '{"Name":"tag:backup","Values":["yes"]}' '{"Name":"instance-state-name","Values":["running"]}'
Friday, 8 November 2013
Openbox: monitor laptop battery via CLI and notify-send
while (true);do acpi -b | perl -n -e 's/.*?(\d+)%.*/$1/;chomp;print "$_...";if ($_ <= 15) {`notify-send batalert:$_`};';sleep 180;done
Would like a beep, but can't get one, no PC speaker on MacBook Air and mplayer buffers.
Wednesday, 6 November 2013
Change X / Openbox screen brightness on CLI
- sudo apt-get -y install xbacklight
- xbacklight +10
- xbacklight +10
- xbacklight +10
- xbacklight -10
- xbacklight -10
- xbacklight -10
Wednesday, 30 October 2013
Latest aws cli tools on Redhat
- wget https://s3.amazonaws.com/aws-cli/awscli-bundle.zip
- unzip awscli-bundle.zip
- sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
Wednesday, 23 October 2013
aws cli run-instances block-device-mappings ephemeral encrypted
aws --version => aws-cli/1.1.1 Python/2.6.8 Linux/3.4.43-43.43.amzn1.x86_64
To encrypt the Ebs volume, add "Encrypted": true to the device params like so:
- aws ec2 run-instances
- --image-id
- ami-eeff1122
- --instance-type
- m2.2xlarge
- --security-group-ids
- sg-eeff1122
- --subnet-id
- subnet-eeff1122
- --private-ip-address
- 10.0.0.2
- --user-data
- file://meta_myserver.txt
- --block-device-mappings
- '[{ "DeviceName":"/dev/sdb", "VirtualName":"ephemeral0" }]'
- '[{ "DeviceName":"/dev/sdb", "VirtualName":"ephemeral0" },{"DeviceName":"/dev/sdc","Ebs":{"VolumeSize":50}}]'
To encrypt the Ebs volume, add "Encrypted": true to the device params like so:
- {"DeviceName":"/dev/sdc","Ebs":{"VolumeSize":50,"Encrypted": true}}
Labels:
aws,
aws-cli,
block-device-mappings,
cli,
command line,
ebs,
encrypted,
ephemeral,
run-instances
Tuesday, 15 October 2013
Test exim from CLI without "mail" command
If you don't have "mail" on the CLI for whatever, weird (Redhat-based) reasons, circumvent like so:
- /path/to/exim -v 'user@domain'
- type a multi-line message here ending with blank line
- hit ^D to end message and send
- you should be returned to shell
Wednesday, 31 July 2013
DHCP on CLI for Ubuntu-like systems
- Add these lines to /etc/network/interfaces, or tweak existing eth0 lines
- auto eth0
- iface eth0 inet dhcp
- bring it up
- sudo ifup eth0
- bring it down
- sudo ifdown eth0
- add some stuff to /etc/dhcp/dhclient.conf
- interface "eth0" {
- prepend domain-name-servers 192.168.100.10, 8.8.8.8, 8.8.4.4;
- supersede domain-search "mydom.com", "mydom-vpc.internal";
- }
- flush on occasion
- ip addr flush eth0
Thursday, 18 July 2013
Zenoss: remodel all Linux servers at once
- su - zenoss
- zenmodeler run --path=/Server/Linux
Labels:
auto,
autodiscovery,
cli,
device,
devices,
discovery,
model,
remodel,
zenmodeler,
zenoss
Monday, 15 July 2013
Selenium test on CLI in 5 minutes using Java
This took me two weeks to nail down looking at it here and there.
- mkdir stests
- cd stests
- wget http://selenium.googlecode.com/files/selenium-java-2.33.0.zip
- unzip selenium-java-2.33.0.zip
- mkdir jars
- find selenium-2.33.0 -type f -name '*jar' -exec mv -v {} jars \;
- rm -rfv selenium-*
- mkdir src
- vi src/Test.java
- use below code
- mkdir out
- javac -d out -cp 'jars/*' src/MyTest.java
- ignore "Notes" output
- cd out
- rm -rfv org
- java -cp '../jars/*:.' MyTest
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;
public class MyTest {
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("Cheese!");
element.submit();
System.out.println("Page title is: " + driver.getTitle());
(new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver d) {
return d.getTitle().toLowerCase().startsWith("cheese!");
}
});
System.out.println("Page title is: " + driver.getTitle());
driver.quit();
}
}
Friday, 3 May 2013
mysqldump between two servers over ssh
- set up ssh keys so server1 user can ssh to a server2
- set $HOME/.my.cnf so both users can get into respective mysql cli without passwords
- see below for sample file
- create the new, empty database on server2, receiving server
- from server1
- mysqldump mydatabase | ssh server2 mysql mydatabase
# $HOME/.my.cnf
[client]
password=myusersmysqlpassword
Thursday, 25 April 2013
tcpdump HTTP headers
- tcpdump -vvvs 1024 -l -A port 80 | egrep '^[A-Z][a-zA-Z\-]+:|GET|POST'
- Match your port, here it is 80, could be 8080 or 443, e.g.
Quick CLI screenshots on Linux or Openbox / Fluxbox
- sudo apt-get -y install imagemagick eog
- import myscreenshot.jpg
- select portion of screen with the crosshairs
- eog myscreenshot.jpg
Wednesday, 24 April 2013
Thursday, 28 March 2013
Run one command on many Linux servers, install pssh, works on Mac
- sudo easy_install pip
- sudo pip install pssh
- Create a file with the list of servers you want to control, call it servers or something similar
- pssh -h servers "date"
- Put your ssh pub key up to all of them
- pssh -h servers -i "echo 'ssh-rsa AA...wh me@myfqdn' >> /home/user/.ssh/authorized_keys"
Taken: http://kaspergrubbe.dk/2012/using-pssh-for-executing-parallel-ssh-commands/
Note: csshX is very nice if you want to see all terminals at once as you type, more later
Note: csshX is very nice if you want to see all terminals at once as you type, more later
Monday, 25 March 2013
Generate gpg keys, upload to server, pull from server, from CLI
- gpg --gen-key
- gpg --list-keys
- gpg --keyserver pgp.mit.edu --send-keys '62E49F5A'
- that funky number is listed in the output of "list-keys", just look carefully
- your funky number will be unique
- should be 8 digits long and hex
- gpg --keyserver pgp.mit.edu --search-keys 'youremail@yahoo.com'
- gpg --keyserver pgp.mit.edu --search-keys 'yourgirl@yahoo.com'
- gpg --keyserver pgp.mit.edu --recv-keys 1F3B6ACA
- Get her key with the ID you saw in previous step
- Use keys to encrypt content
- Can be encrypted for multiple people in one go, and only those listed can open the result
Friday, 15 March 2013
Redirect all command output, stdin/stderr, to a file on Linux
puppet agent --test --noop >/var/tmp/puppet_noop_20130315 2>&1
Notes:
- The 2>&1 redirects stderr to where stdin points
- stdin points to the console by default unless you change that
- here stdin is redirected to a file under /var/tmp
Wednesday, 6 February 2013
Monday, 8 October 2012
sed with the capital E option on the Linux CLI
No, you are not crazy, sed on Linux has a secret, BSD compatible option, -E that is equivalent to -r.
Subscribe to:
Posts (Atom)
Interview questions: 2020-12
Terraform provider vs provisioner Load balancing Network Load Balancer vs Application Load Balancer Networking Layer 1 vs Layer 4 haproxy u...
-
CRITICAL: AWS now offers internal VPC DNS! Below is no longer necessary AFAIK. Woo hoo! http://aws.amazon.com/about-aws/whats-new/2014/...
-
build sudo apt-get install git gcc sudo apt-get install automake autoconf git clone git://github.com/rriley/tsunami-udp.git cd tsunam...
-
From: https://bugs.eclipse.org/bugs/show_bug.cgi?id=382972#c4 Assumptions: jEdit was installed into /Applications directory. Close any...