"On a misty morning, I was a bit late to catch a train that would take me to uni, and probably not very well awake. The place I lived at had no barriers along the railways, so you were supposed to cross only when the lights were green using a dedicated path. Closing in on the train station, I saw trough the mist that the red light had just been switched on, and, foolishly proceeded to run towards the train station (I was about 30 meters / 100 feet way). I got to the rails, continued running to the other side where the train platform was, heard a loud train horn, saw the train nearing at full speed in the corner of my eye, stumbled on the previous-to-last rail, fell with my hands on the platform, raised myself as quickly as I could. By the time I got up and turned my head around, the train was passing by me and everybody on the platform was looking at me in shock. I had bloody hands from the stumbling / lifting and the shock hit me that I was about 1 or 2 seconds away from being killed."
- Andrei Vladescu-Olt
function __autoload($class) { //prevent CI and Pear classes from being loaded. if(!strstr($class, 'CI') && !stristr($class, 'PEAR')){ require_once(PATH_TO_LIBRARIES."$class.php"); } }
- Andrei Vladescu-Olt
diff <(lsof -p 1234) <(sleep 10; lsof -p 1234) This command takes a snapshot of the open files for a PID 1234 then waits 10 seconds and takes another snapshot of the same PID, it then displays the difference between each snapshot to give you an insight into what the application is doing.
- Andrei Vladescu-Olt
cygrunsrv -I AutoSSH -p /usr/bin/autossh -a "-M 20000 -L localaddress:port:serveraddress:port user@ssh.host.name" -e AUTOSSH_NTSERVICE=yes # Tweak Windows service settings. 1. Open the Services management console (Administrative Tools -> Services). 2. Edit the properties of the AutoSSH service. 3. In the "Log On" tab, select the "This account" radio button and set the service to run as your current user. 4. Start the service.
- Andrei Vladescu-Olt
This is a very common and very annoying problem. Your remote host expects some character to be used as "erase", a terminal program you use sending some character as "erase". If they differ - sometimes you getting ^? or ^H when pressing backspace. So to fix this you just need bring both parts in sync. 1. When connected type "stty -a" and in output find what is expected to be an erase code (erase = ^? f.e.) 2. Type CTRL-v and press your backspace. You'll see what code is sent as "erase". ^H f.e. 3. Type "stty erase ^H" and this is it. Now they'll understand each other.
- Andrei Vladescu-Olt
function GetFileDir($php_self){ $filename = explode("/", $php_self); // THIS WILL BREAK DOWN THE PATH INTO AN ARRAY for( $i = 0; $i < (count($filename) - 1); ++$i ) { $filename2 .= $filename[$i].'/'; } return $filename2; } echo GetFileDir($_SERVER['PHP_SELF']);
- Andrei Vladescu-Olt
Export In this example, we will export the 'mytestdb' database into a file called 'mytestdb.sql': mysqldump -u root -p mytestdb > mytestdb.sql Er, that's it. Once done, the sql file can be copied to a new Slice or server ready to be imported into MySQL. Import Importing the data is just as easy but involves two steps. The first step is to create a blank database ready to receive the data (remember this is on the Slice or server to which the database is going to imported): mysqladmin -u root -p create mytestdb2 Once done, all that is left is to actually import the data: mysql -u root -p mytestdb2 < mytestdb.sql
- Andrei Vladescu-Olt
Solution for Ubuntu 9.04 #apt-get install python2.5 Change the python version there execute the fail2ban-server script. /usr/bin/fail2ban-server (edit) Change the first line from: #!/usr/bin/python --> to #!/usr/bin/python2.5 After that restart fail2ban # /etc/init.d/fail2ban restart
- Andrei Vladescu-Olt
So, check that all your logs are synchronized: all logs files (auth.log, syslog,..) must use the same time reference (if your server is not very busy, there will probably be an important difference between the output of [1]date command and the last event logged in syslog. You can force to generate a log in syslog using the logger command and check then with the output of date command) # date Wed Nov 28 13:49:02 CET 2007 # tail -2 /var/log/auth.log Nov 28 13:39:12 <SERVERNAME> sudo: pam_unix(sudo:session): session opened for user roo t by <user>(uid=0) Nov 28 13:39:12 <SERVERNAME> sudo: pam_unix(sudo:session): session closed for user roo t
- Andrei Vladescu-Olt
Put the following in your ".git/config" file: [color] branch = auto diff = auto status = auto [color "branch"] current = yellow reverse local = yellow remote = green [color "diff"] meta = yellow bold frag = magenta bold old = red bold new = green bold [color "status"] added = yellow changed = green untracked = cyan
- Andrei Vladescu-Olt
jQuery.fn.exists = function(){return jQuery(this).length>0;} Then in your code you can use if ($(selector).exists()) { // Do something }
- Andrei Vladescu-Olt
With --color=auto, grep will highlight the matching portion of the line in color when it outputs to a terminal, while avoiding the use of any potentially-harmful terminal control sequences when standard output goes somewhere else (like a file or pipe). If you like the colorful grep, you can simply export GREP_OPTIONS='--color=auto' in your shell startup script. grep's default highlight uses a red color. You can change this color by setting the GREP_COLOR environment variable to a different escape sequence fragment. I use export GREP_COLOR='1;32', which produces a bright green.
- Andrei Vladescu-Olt
-webkit-transform: rotate(-90deg); moz-transform: rotate(-90deg); filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); The rotation property of the BasicImage filter can accept one of four values: 0, 1, 2, or 3 which will rotate the element 0, 90, 180 or 270 degress respectively.
- Andrei Vladescu-Olt