jeudi 26 mars 2015

(Linux - Command) How to disable keyboard's NUMPAD (located right side of the keyboard)


Does anyone knows how to do this?


I want to disable all numpads, the ones located on the right side of the keyboard.


How can I do that? Ofcource, including how to revert it back to re-enable it too?


I have tried different stuff, like remapping:



xmodmap -e "keycode # = """


But I get an error:



xmodmap commandline1: bad keycode value


Did I do it wrong?



How to print file content *and delete printed content* from file?


In Linux bash shell, How can I print file content and delete printed content from file?


I have a program writing texts to a file repeatedly. On a Linux shell prompt, I want to print the contents of the file and then delete printed contents from the file repeatedly, to make my file size small enough.


Do we have bash command lines or combinations to do that?



Keyboard merely plugged in greatly increases kernel boot time


Specs are here. I am using a K65 RGB. I am using the ckb-git package from the AUR to provide basic input functionality.



  • With Keyboard and with driver:


Startup finished in 3.100s (firmware) + 5.648s (loader) + 31.800s (kernel) + 5.664s (userspace) = 46.213s



  • Without Keyboard and with driver:


Startup finished in 2.873s (firmware) + 5.652s (loader) + 2.395s (kernel) + 5.855s (userspace) = 16.777s



  • With Keyboard without driver:


Startup finished in 3.120s (firmware) + 5.654s (loader) + 31.735s (kernel) + 5.583s (userspace) = 46.093s



  • Without Keyboard without driver:


Startup finished in 2.879s (firmware) + 5.653s (loader) + 2.279s (kernel) + 6.008s (userspace) = 16.821s


As you can see, the pure act of having the keyboard plugged into the computer causes the kernel to boot about 30 seconds slower. This is kindof rediculous.


While the kernel is booting it just says:



starting version 218


if I dont have it plugged in. I believe this is referring to the kernel booting.


If the keyboard is plugged in, then it says:



starting version 218
[ random number] usbhid 3-2:1.1: can't add hid device: -110
worker [66] /devices/pci0000:00/0000:00:14.0/usb3/3-2 is taking a long time
[ random number about times two] usbhid 3-2:1.2: can't add hid device: -110


Then it boots to arch.


It is good to note that if I plug in the keyboard after it boots to arch, it takes about 30 seconds for the keyboard to be recognized (but I can still use my old keyboard).



How to find whether a file exists in a directory or sub-directory or not


Try to write a code which indicates whether a named file exists or not in your home directory or any of its subdirectories. Any help??



Does the inode change when renaming or moving a file?


in PHP the fileinode() functions returns the inode of a file. I was wondering if I can use it to determine if a file was renamed, moved or modified.


I did some tests and it seems the inode stays the same after rename. Is this behavior consistent? Does it work for any type of file, on any linux distribution?



2 monitors works as wide one (xorg.conf, intel+nvidia)


I have 3 monitors (1 intel + 2 nvidia). After some magic with xorg.conf they started to work, but nvidia monitors works as one wide monitor (any fullsize window half/half seperated).



Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
Screen 2 "Screen2" RightOf "Screen0"
Screen 1 "Screen1" RightOf "Screen2"
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
Option "Xinerama" "on"
EndSection

Section "Device"
Identifier "Card0"
Driver "intel"
BusID "PCI:0:2:0"
EndSection

Section "Device"
Identifier "Card1"
Driver "nvidia"
BusID "PCI:1:0:0"
EndSection

Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection

Section "Monitor"
Identifier "Monitor1"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection

Section "Monitor"
Identifier "Monitor2"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"

EndSection

Section "Screen"
Identifier "Screen1"
Device "Card1"
Monitor "Monitor1"
Option "TwinView" "0"
EndSection

Section "Screen"
Identifier "Screen2"
Device "Card1"
Monitor "Monitor2"
Option "TwinView" "0"
EndSection


I'm so sorry for my English and idiotic xorg.conf :)



Combine lines of file to string [on hold]


I am trying to have a file inputted by my script and put into a string to be put into another file.



./script.sh -u uuids.txt -s servers.txt


Each file will have a list with each value being on it's own line and where each line on each file belong together each time the string is made.



user:UUID:*:SERVER


That is an example of the string with the variables put into it.


I have the getops part right and I am able to print out the file contents correctly. I am asking for a way to add the lines one by one to the string to be added to a new line in another file.


I was thinking having awk split the lines within a loop that runs how ever many times for the lines in the files this would then save the overall string (pictured above) to a new line of a file with the >>.