- 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
Wednesday, 31 July 2013
DHCP on CLI for Ubuntu-like systems
Saturday, 27 July 2013
Match different sets of equally distributed things into groups: hosts and weeks in the year
Use modulo if you want to match up sets of things into groups.
They have to be equally distributed by number.
Here it is with modulo 3: hosts on left, weeks of the year on right.
They have to be equally distributed by number.
Here it is with modulo 3: hosts on left, weeks of the year on right.
Labels:
correlation,
distribution,
groups,
matching,
modulo,
sets
Wednesday, 24 July 2013
Clear CLI with 1000 blank lines
For when you really want older output way out of your way, e.g., debugging, copying/pasting.
- for i in {1..1000};do echo;done
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
Wednesday, 17 July 2013
Mac "Screen Sharing" using vncviewer and ssh tunnel
problem: Remmina (or similar) fail to connect to Mac over Cisco wireless (or whatever router is the problem), and you are tired of having to physically connect your Mac to make VNC work.
- make sure "Screen Sharing" is on as normal on your Mac
- ssh -L5900:localhost:5900 192.168.X.X
- replace 192.168.X.X with the IP of your Mac
- "Remote Login" is on
- set display to "Scaled" and "1024x768" if your Mac is just an Outlook client now
- vncviewer -encodings 'copyrect tight zrle hextile' localhost:5900
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();
}
}
Saturday, 6 July 2013
Could not update ICEauthority file /home/myuser/.ICEauthority
Your home directory perms got messed up somehow
- sudo chown myuser:myuser /home/myuser
If it still doesn't work, this may be necessary as well
- sudo chmod 750 /home/myuser
Friday, 5 July 2013
apache-cassandra11 conflicts with apache-cassandra11-1.1.11-1.noarch
The Error:
Running rpm_check_debug
ERROR with rpm_check_debug vs depsolve:
apache-cassandra11 conflicts with apache-cassandra11-1.1.11-1.noarch
Solution:
- wget http://rpm.riptano.com/community/noarch/apache-cassandra11-1.1.11-1.noarch.rpm
- rpm -i apache-cassandra11-1.1.11-1.noarch.rpm --nodeps
This might be necessary before step 2, but make sure you back up your data first, even this should not delete it, you never know:
- yum remove apache-cassandra11
Thursday, 4 July 2013
Poke an ssh tunnel to your house
- remote server
- ssh -R 19999:localhost:22 myhomeuser@myhome.domain.org
- home server
- ssh myremoteuser@localhost -p 19999
- use below on your remote server to keep connection open
- ~/.ssh/config
Host myhome.domain.org
User myhomeuser
ServerAliveInterval 60
Wednesday, 3 July 2013
bash: funky hostname expansion in for loop
- for host in myhosts-{2{2,{6..9}},3{2,5,{7..9}}}.mydomain.com
- do
- echo $host
- echo "ssh $host cmd"
- done
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...
-
kubectl --cert=/tmp/tls.crt --key=/tmp/tls.key create secret tls tls-wc-ingress
-
apt-get install exim4 dpkg-reconfigure exim4-config Select: internet site; mail is sent and received directly using SMTP IP-addresses...
-
brew install python3 mkdir -p ~/bin/python3 python3 -m venv ~/bin/python3 source ~/bin/python3/bin/activate enjoy!