Drupal 7: How to reset admin password

After several research I tried the following code stored it as a php file in the root directory

saved it as password-reset-admin.php

<?php
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
require_once DRUPAL_ROOT . '/includes/password.inc';
if (isset($_GET['pass']) && !empty($_GET['pass'])) { 
$newhash = user_hash_password($_GET['pass']);
}
else {
die('Retry with ?pass=PASSWORD set in the URL');
}
$updatepass = db_update('users') 
->fields(array(
'pass' => $newhash,
// 'name' => 'admin',
// 'mail' => '<a href="mailto:yourmail@domain.com'">yourmail@domain.com'</a>;
))
->condition('uid', '1', '=')
->execute();
print "Done. Please delete this file immediately!";
drupal_exit();
 ?>

And after that access the php file through the following:

 https://yoursite.com/password-reset-admin.php?pass=newpassword

It just worked..:) Hope it helps others.

Please make sure you delete the file.

source

Installing slax linux to usb key / pendrive

  1. Download the ZIP file
  2. Extract to your fat32 formatted USB pen drive, so there’s only the “slax” folder on its root
  3. Inside /slax/boot/, execute bootinst.bat as root

Linux: search strings within files in a directory

grep -rnw ‘directory’ -e “pattern”

found here

Apache url rewrite – removing .php extension via .htaccess

Add to the .htaccess (make sure the vhost can read htaccess files)

# Avoid listing files, enable multiviews
Options -Indexes -MultiViews
# Enable RewriteEngine
RewriteEngine On
# Don’t rewrite directory names
RewriteCond %{REQUEST_FILENAME} !-d
# Don’t rewrite file names
RewriteCond %{REQUEST_FILENAME} !-f
# Remove .php extension
RewriteRule ^([^\.]+)$ $1.php [NC,L]

Converting WAV to MP3 linux commandline

First: fuck you microsoft piece of shit.

command:

 

avconv -i damn.wav damn.mp3

How to generate a new privilege key (token) in teamspeak3

Teamspeak3 has the most stupid password recovery system ever. If you unfortunately have ever to deal with this bullshit, here’s what u have to do:

telnet localhost 10011
login serveradmin <urpass>
use sid=1
tokenadd tokentype=0 tokenid1=2 tokenid2=0
<new token shown>
quit

 

 

Drupal – Make views url overwrite taxonomy url

Set the correct alias you want in the taxonomy: site/dogs

Create the view, set the path as the taxonomy: site/taxonomy/term/32

Drupal: Adding a quick site-wide Contact Form with a block

1. Enable core Contact module
2. Configure module (email, categories, etc) & module permissions (anonymous users being able to use contact form, etc).
3. Add or Enable menu link pointing to contact.
4. Add a block “Contact Form Intro” and make it appear only to contact.

Enjoy.