Posts

Showing posts from July, 2013

DHCP on CLI for Ubuntu-like systems

Add these lines to /etc/network/interfaces, or tweak existing eth0 linesauto eth0iface eth0 inet dhcpbring it upsudo ifup eth0bring it downsudo ifdown eth0add some stuff to /etc/dhcp/dhclient.confinterface "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 occasionip addr flush eth0

Match different sets of equally distributed things into groups: hosts and weeks in the year

Image
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.


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

Zenoss: remodel all Linux servers at once

su - zenosszenmodeler run --path=/Server/Linux 

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 Macssh -L5900:localhost:5900 192.168.X.Xreplace 192.168.X.X with the IP of your Mac"Remote Login" is onset display to "Scaled" and "1024x768" if your Mac is just an Outlook client nowvncviewer -encodings 'copyrect tight zrle hextile' localhost:5900

Selenium test on CLI in 5 minutes using Java

This took me two weeks to nail down looking at it here and there.
mkdir stestscd stestswget http://selenium.googlecode.com/files/selenium-java-2.33.0.zipunzip selenium-java-2.33.0.zipmkdir jarsfind selenium-2.33.0 -type f -name '*jar' -exec mv -v {} jars \;rm -rfv selenium-*mkdir srcvi src/Test.javause below codemkdir outjavac -d out -cp 'jars/*' src/MyTest.javaignore "Notes" outputcd outrm -rfv orgjava -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.sendKe…

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

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.rpmrpm -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

Poke an ssh tunnel to your house

remote serverssh -R 19999:localhost:22 myhomeuser@myhome.domain.orghome serverssh myremoteuser@localhost -p 19999
use below on your remote server to keep connection open~/.ssh/configHost myhome.domain.org   User myhomeuser   ServerAliveInterval 60

bash: funky hostname expansion in for loop

for host in myhosts-{2{2,{6..9}},3{2,5,{7..9}}}.mydomain.comdo echo $hostecho "ssh $host cmd"done