Sunday, September 13, 2015

SUSE 13.1 Bottle new network configuration dhcp setup via AutoYast xml

Starting from SUSE 13.1 


<pre>
           <configure>
                <networking>
                        <dns>
                                <dhcp_hostname config:type="boolean">false</dhcp_hostname>
                                <domain>domain.com</domain>
                                <hostname>fakely-hostname</hostname>
                                <resolv_conf_policy/>
                                <write_hostname config:type="boolean">false</write_hostname>
                        </dns>
                        <ipv6 config:type="boolean">false</ipv6>
                        <keep_install_network config:type="boolean">true</keep_install_network>
                        <managed config:type="boolean">false</managed>
                </networking>
              </configure>

<!-- Untill next reboot keep DHCP on -->
<!-- Below section is for creating a static ifcfg-<interfacename> file on the fly -->



</pre>

Sunday, April 12, 2015

CORSAIR KEYBOARD K60 / K90 FIRMWARE UPGRADE ISSUE / SOLUTION KBD BOOT LOADER

THE SYMPTOMS:
- k60 plugged in, all 'standard 108' keys work, backlight does not, media keys do not, volume does not, winLock does not and so on
- Going to Start->Devices and Printers shows keyboard as 'KBD BOOT LOADER'
- You're stark raving mad, and are not going to take it anymore!

WARNING NOTES:
- This might wreck a port on your machine where you might want to plug in the k60. By 'wreck' I mean you won't be able to use it for the k60 Keyboard Plug. I recommend using a secondary machine or alternate windows install.

k60 Keyboard

STEPS:
1) Make sure you have the k60's latest software and fimware installers unzipped somewhere.
2) MOST IMPORTANT STEP Go to Start->Control Panel->Power Options->Change Plan Settings->Change Advanced Power Settings->USB Settings->USB selective suspend setting->Disabled
3) Plug your k60 into a DIRECT USB 2.0 PORT on your machine.
4) Go to Start->Devices and Printers.
5) Right-click on KBD BOOT LOADER and select 'Properties'
6) Click on the Hardware tab. You should see 'HID Keyboard Device' and another item (I forgot what it says, but it shouldn't say 'Corsair Gaming Keyboard'). Select the other item, then click 'Properties'
7) Click on the 'Change Settings' button on the first page of the Properties dialog
8) Click on 'Update Driver'
9) Select 'Browse my computer for driver software'
10) Select 'Let me pick from a list of device drivers on my computer'
11) Click 'Have Disk' It might look for your a: drive first (good old windows)
12) In the box 'copy manufacturer's files from put 'C:\Program Files (x86)\corsair\k60 firmware update\Driver\X64'
13) You should be able to select the Corsair driver somehow. When your done Your 'KBD BOOT LOADER' properties should have 'Corsair Gaming Keyboard' and 'HID Keyboard Device'
14) Select the HID Keyboard Device
15) Click 'Change Settings'
16) Click the Driver Tab
17) Click 'Uninstall'. Windows will cry about this. Let it do it's thing
18) Once you 'OK' everything they k60 won't work at all. DON'T PANIC! You should also not see KBD BOOT LOADER in Devices and Printers
19) UNINSTALL k60 EVERYTHING
20) Install the k60 Firmware Updater.
21) When the firmware is installed, start the updater application up and update the keyboard.
22) It should complete at this point. Your keyboard won't light up just now. DON'T PANIC!
23) Unplug the k60 from it's current port. Plug it into another one.
24) Start the Software Installer and let it complete.
25) Keyboard should light up.

Tuesday, February 17, 2015

Mount SAMBA (SMBFS) share on OSX MAC APPLE

Mount SAMBA (SMBFS) share on OSX MAC APPLE (Mavericks users)

Modify the /etc/auto_master (sudo vi /etc/auto_master) file and add the following line:

/- auto_smb -nosuid

Create a folder on your system to place your mount in:

sudo mkdir /mnt

Create an /etc/auto_smb (sudo vi /etc/auto_smb) file that contains the following:

/mnt/mount_point -fstype=smbfs,soft ://user:pass@smbserver/share

Next, run the following command to update your settings:

sudo automount -vc

A few notes:

  • The soft parameter specifies OSX to not halt on failure to connect to the SMB server during boot.
  • When entering the password, it's better to URL encode it as some special characters will cause the automount to fail silently.
  • nosuid parameter in the /etc/auto_master file prevents OSX from mounting the resource as readonly by root (see update below!).

Tuesday, December 9, 2014

Is it possible to "hotplug" a CPU on a running Red Hat Enterprise Linux 5 system?

Issue

  • Is it possible to "hotplug" a CPU on a running Red Hat Enterprise Linux system?
  • How to dynamically enable or disable a CPU on a running system.


Resolution

Red Hat Enterprise Linux 5 supports the cpu-hotplug mechanism, which allows for CPUs to be dynamically disabled and re-enabled on a system without requiring a system reboot.
In order to disable a CPU core in a running machine, use the file /sys/devices/system/cpu/cpuX/online.

The following command will disable a CPU:
    # echo 0 > /sys/devices/system/cpu/cpuX/online
Where X is the ID of the CPU as determined from /proc/cpuinfo.

To re-enable the CPU, run:
   # echo 1 > /sys/devices/system/cpu/cpuX/online

Note: CPU hot-plugging will only work if physical hotplug is supported by the hardware.
Note: There are some architectures in which a CPU cannot be disabled due to a dependency on a certain CPU. In such cases you will notice that the /sys/devices/system/cpu/cpuN/online file is missing or not writeable.

For further details on CPU hotplugging, see this file:
/usr/share/doc/kernel-doc-2.6.18/Documentation/cpu-hotplug.txt
The documentation files are in the kernel-doc package, which can be installed from RHN.

LAUNCH JENKINS AGENT and DISCONNECT JENKINS AGENT using CURL post requests in LINUX / UNIX

WHY do we need this function?
This function helps when you have some changes made to .bashrc or .bash_profile and those changes need to be reloaded and taken into account by jenkins agent.



Bash Function to LAUNCH JENKINS AGENT and DISCONNECT JENKINS AGENT using CURL

function launch-jenkins-agent
{
        SERVERNAME="server00"
        #SERVERNAME="server01"
        echo "usage: launch-jenkins-agent "
        cat $1 | awk '{print "curl --form \"offlineMessage=Restarting_agent_after_P4_changes\" https://${SERVERNAME}/computer/"$1"/launchSlaveAgent "}' |sh -x
}


function disconnect-jenkins-agent
{
        SERVERNAME="server00"
        #SERVERNAME="server01"
        echo "usage: disconnect-jenkins-agent "
        cat $1 | awk '{print "curl --form \"offlineMessage=Restarting_agent_after_P4_changes\" https://${SERVERNAME}/computer/"$1"/launchSlaveAgent "}' |sh -x

}


FUNCTION USAGE:
# disconnect-jenkins-agent  /tmp/multiple-hostnames
# launch-jenkins-agent   /tmp/multiple-hostname



HTTP POST and GET using cURL in Linux

Linux provides a nice little command which makes our lives a lot easier.


GET:

with JSON:
curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X GET http://hostname/resource

with XML:
curl -H "Accept: application/xml" -H "Content-Type: application/xml" -X GET http://hostname/resource


POST:
For posting data:
curl --data "param1=value1&param2=value2" http://hostname/resource

For file upload:
curl --form "fileupload=@filename.txt" http://hostname/resource

RESTful HTTP Post:
curl -X POST -d @filename http://hostname/resource

For logging into a site (auth):
curl -d "username=admin&password=admin&submit=Login" --dump-header headers http://localhost/Login
curl -L -b headers http://localhost/
 
 
In cases where the webservice responses are in JSON then it might be
 more useful to see the results in a clean JSON format instead of a very
 long string. Just add | grep }| python -mjson.tool  to the end of curl 
commands here is two examples:

GET approach with JSON result
curl -i -H "Accept: application/json" http://someHostName/someEndpoint | grep }| python -mjson.tool
POST approach with JSON result
curl -X POST -H "Accept: Application/json" -H "Content-Type: application/json" http://someHostName/someEndpoint -d '{"id":"IDVALUE","name":"Mike"}' | grep }| python -mjson.tool

enter image description here
 
 

Example:

curl --header "X-MyHeader: 123" www.google.com
You can see the request that curl sent by adding the -v option.
 
 
Ref: http://stackoverflow.com/questions/14978411/http-post-and-get-using-curl-in-linux 

Monday, September 29, 2014

Update the bash history file in real-time immediately

#Add the following 2 lines to #.bashrc file

shopt
-s histappend PROMPT_COMMAND="history -a;$PROMPT_COMMAND"