Arpan Dubey
eeprom_img

How to clear supervisor password of a Thinkpad Laptop

  We love thinkpads. They are safe, reliable and durable laptops. All modern Thinkpad laptops come with advance security chip (TPM) and BIOS settings are encrypted inside EEPROM to prevent unauthorized access to the system and BIOS. Unlike desktops, there is no security jumper for setting/overriding the BIOS supervisor mode. The common technique of disconnecting "BIOS battery" does not work because as soon as the laptop detects that there is a BIOS corruption, it recovers the saved and encrypted BIOS security details from EEPROM. This all sounds great and is very useful for security of a laptop. But, problem starts when one misplaces / forgets the supervisor password.  Lenovo customer service…
Read More
Screenshot_2016-11-08_14-15-55

How to mount a partition from inside a hard disk image

Mounting specific partition from inside a disk image in linux. Step 1 :  Find the partition structure in the disk image file. # fdisk -lu disk.img Step 2 : The screen above says that 1 sector = 512 bytes, so if you want to mount the third partition in this, use the math : Partition stating point = offset x 512 = 17803264 * 512 . Then use the following command. # /sbin/losetup /dev/loop1 disk.img -o $((17803264 * 512)) # mount -o ro /dev/loop1 /mnt/target If the partition contains a real filesystem, you should be able to access the data in the partition. Once you are done, you can use…
Read More

Method Chaining in PHP

Method Chaining is a technique where different methods are chained together into single instruction. For example, $dao->execute()->prepare($var) ; The above method of chaining will work as long as the functions called will return an object to chain on. For example, object->function_3(); (object-function_2())->function_3();      // function_3 still gets an obj ( ( object->function_1() )->function_2() )->function_3();   // finally The class definition for this is: <?php /** method chaining class */ class myclass{ public $var ; public function_1(){ echo __FUNCTION__"\n" ; return $this; }      public function_2(){ echo __FUNCTION__"\n" ; return $this; }      public function_3(){ echo __FUNCTION__"\n" ; return $this; } } All the function above returns $this and can be chained.…
Read More
kenpoliran_1328761468_95

Bootstrap CSS3 Class LIst

Basic Bootstrap Classes .container sets fixed width to an element (which changes depending on a screen size to other fixed values, so it's still responsive) on all screen sizes except xs - on xs, the width is calculated automatically (this behaviour can be changed) a fixed width responsive website should be wrapped in .container (or just the content without menu, whatever - it's up to you) .container can't be nested! .container-fluid sets 100% width, margin-left and margin-right: auto, padding-left and padding-right: 15px a full screen website should be wrapped in .container-fluid .container-fluid can't be nested! .row creates horizontal groups of columns (which usually have width classes, see below) must be…
Read More

How to disable php session() cookie ?

Why would you want to do that? Is it because you are executing an application in php and its not working. Sometimes you need to refresh the page twice to get it work, or maybe its only working once and then it would work only after executing the cookie cleaner? Solution : Add the following to your .htaccess file: SetEnv session.use_cookies='0'; Of, before you call session_start(), add the following to your php files: ini_set('session.use_cookies', '0'); To permanently disable cookies for session on the server ( not recommended !), add the following to your php.ini file : session.use_cookies = 0 Comments welcome. Regards
Read More

fatal error: bcm_host.h: No such file or directory compilation terminated

fatal error: bcm_host.h: No such file or directory compilation terminated system is LInux opensuse 13.2 . I encoutered this problem while compiling mplayer. It would fail to compile. I disabled many extensions but it would not solve the problem. There is very little information available about this file online. Mostly its about the discussion of Raspberry. I tried changing the reference to the file in source code, but compilation fails again. Solution  : Download the mplayer source again and compile it afresh. It will automatically download the latest version of ffmpeg and all would go well. Comments warmly welcomed. Regards.
Read More
minion

Command for rsync for ssh running on non-default port no 22

Rsync is great unix tool to sync files between systems. It has inbuilt compression much needed for reducing network load, transfers in acrhieve mode so that permission are preserved. However, the best feature of rsync is that it transfers in delta mode. That is, compares remote and local files, and only transfers the files that are changes ! Awesome and cool for many years. However, due to security reasons I ran my ssh server on a remote system at a non standard port. Since port 22 is constantly bombarded with login attempts, it is a great security strategy to use a non default port. The command to run for rsync…
Read More

How to secure SSH on Remote server ?

Simple strategies to secure ssh server. Ssh is perhaps the most secure remote shell around, and at the same time the most abused one too. I have like a thousand attempts on my servers on default ssh port no 22. The tries are mostly dictionary attacks and brute forcing. Default security of ssh to delay the logins and use of strong passwords usually suffice to tackle this. How attackers plan and execute a dictionary attack ? First of all "nmap" is used to check if port 22 is open and is serving, then script execute dictionary attack on the port. This attack may run for years trying out various passwords…
Read More

Thinkpad touchpad with Linux

The touchpad is not performing as good as it used to do on LInux. Here is a small tweak that would make it behave better : Thinkpad W520, OpenSUSE 13.2 . Check if this package is installed on your system : xf86-input-synaptics-1.8.1-1.1.x86_64 The package name is <synaptics> and should be available with the package manager of your choice on all major linux platforms. The procedure should work with very little modification on Fedora, OpenSuse, Debian, Ubuntu, Arch and most other linux distributions and threir derivatives. Usually installed as default. Tweaks using the command line tools for a more sane mouse experience : Check the current settings of the touchpad. This…
Read More