test

Written by Leif Stenfeldt. Posted in Tips

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
  $(document).ready(function(){
    $(".containerdiv").click(function(){
      $(this).find(".inch").slideToggle("slow");
    });
  });
</script>
</head>

<body>
  <h2>This is a heading</h2>
  <div class="containerdiv">klik her
    <div class="inch">dette er teksten.</div>
  </div>
  <br><br>
  <div class="containerdiv">klik her2
    <div class="inch">dette er teksten2.</div>
  </div>
</body>

 

Test

13 views

mc – history poisoning

Written by Leif Stenfeldt. Posted in FreeBSD, Tips

Argh… my history file is full of linies like this:
cd “`printf “%b” ‘\0057’`”
cd “`printf “%b” ‘\0057home\0057ciprian`”

Here is a quick-fix to the history poisoning when using csh shell on a FreeBSD server:

Insert this code at the end of the .cshrc file.

mv .history .hist
grep -v "printf" .hist | grep -v "echo_style" > .history
rm .hist

 

Then, every time you log in, the history file will be cleaned for mc-crap.

479 views

Move WFV

Written by Leif Stenfeldt. Posted in PHP, Tips, Wordpress

Transfer WP file version to an other site?

You will need to recalculate the data location length.

Here is a quick made converter.

<?php

/*
Hvis WFV (WP file version) SQL-data skal flyttes til anden webside, kræves det en genberegning af direktorie+fil længe. 

a:4:{s:4:"size";s:6:"2.05Mb";s:4:"path";s:75:"/var/www/htdocs/public_html/noah.crysberg.dk/wp-content/wfv_files/Certifikater.pdf";s:4:"name";s:16:"Certifikater.pdf";s:4:"type";s:3:"pdf";}
                                          ~~  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Input: filename.sql
Output: NEW-filname.sql
*/

$filename="wp_wfv_files.sql";

$reg='|.*path\\\";s:([0-9]{1,3}):(\\\".*?\\\")|i';

if ($file = fopen($filename, "r")) {
	while(!feof($file)) $a[] = fgets($file);
	fclose($file);
}



$file = fopen("NEW-".$filename, "w");
foreach ($a as $key => $line) { 
	$line = preg_replace_callback(
		$reg,
		function ($matches) {
			return str_replace( 'path\\";s:'.$matches[1], 'path";s:'.(strlen($matches[2])-4), $matches[0]);
		},
		$line
	);
	fwrite($file, $line);
//	echo $line;    	
}
fclose($file);
		
?>

 

427 views

Install Google Chrome

Written by Leif Stenfeldt. Posted in Linux, Tips

Google Chrome isn’t in the repositories – however, Chromium is.

Google Chrome is only available for 64-bit Linux. I’ve included directions for 64 below.

To install Google Chrome, run the following:

sudo apt-get install libxss1 libappindicator1 libindicator7
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome*.deb

If error messages pop up after running the command sudo dpkg -i google-chrome*.deb then run the command

sudo apt-get install -f

and then re-run the previous command. The error messages mentioned should include something similar to

google-chrome-stable depends on [lib-example]; however; Package [lib-example] is not installed.

This installs a needed library for Google Chrome, then downloads the latest version of Chrome to a temporary directory and installs it. Run google-chrome to start the browser.

During the installation a PPA is added to your system so that Google Chrome receives the latest updates whenever you check for system updates.

471 views

Synology – Hyper Backup not completing

Written by Leif Stenfeldt. Posted in Synology, Tips

Reverting to a previous version of HyperBackup fixed my problem.

I manually install the previous version of HyperBackup it can be found here: http://download.synology.com/download/Package/spk/HyperBackup/2.0.1-0384/

You need to uninstall the current version first, then manually install the previous version using the .sdk that matches your hardware.

Make sure that HyperBackup isn’t set to auto update.

I keep a backup of the last working version of HyperBackup here 😉

HyperBackup-armada38x-2.0.1-0384.spk
HyperBackup-armada370-2.0.1-0384.spk
HyperBackup-armada375-2.0.1-0384.spk
HyperBackup-armadaxp-2.0.1-0384.spk
HyperBackup-armv5-2.0.1-0384.spk
HyperBackup-armv7-2.0.1-0384.spk
HyperBackup-comcerto2k-2.0.1-0384.spk
HyperBackup-hi3535-2.0.1-0384.spk
HyperBackup-i686-2.0.1-0384.spk
HyperBackup-monaco-2.0.1-0384.spk
HyperBackup-ppc-2.0.1-0384.spk
HyperBackup-x86_64-2.0.1-0384.spk

To find out which version to download I downloaded HyperBackup from Synology.com download section for compareation.

512 views

Rapberry Pi – on-screen keyboard

Written by Leif Stenfeldt. Posted in Tips

On-Screen keyboard
Installing the on-screen keyboard is not the solution to develop software or write long text documents on the Raspberry PI, but it is a must-to-have to make complete the user interaction options. Installing the keyboard is a very simple operation that can be done with a single command from the terminal:

sudo apt-get install matchbox-keyboard

just as it is explained in the product document page on Element14. The documentation says that the keyboard (after installation and reboot) is accessible on-screen from the Menu->Accessories->Keyboard. Doing several installations I have verified that the keyboard is not always listed as a new menu option; one of the reasons depends on the previous presence of a physical keyboard connected to the Raspberry or not. To be sure that the on-screen keyboard is added to the desktop menu after installation the better choice is to manage the Raspberry PI from remote via SSH.

The on-screen keyboard can be shown by your applications or bash scripts with the command

matchbox-keyboard
552 views

Proxmox – add new disk – quickguide

Written by Leif Stenfeldt. Posted in Linux, Proxmox, Tips

cfdisk /dev/sda
mkfs.ext3 /dev/sda1
mkdir /disk2
blkid /dev/sda1

nano /etc/fstab
indsæt UUID=”97174799-0902-43b7-86d3-e42417xxxxxx” /disk2 ext3 errors=remount-ro 0 1
mount /disk2

Proxmox – log out and then back in
Datacenter/storage/add/Directory
id: Disk2
Directory: /disk2
Content: Diskimage/Container template

441 views

ESXi 6.5 – Memory limit doesn’t accept the negative value -1048576

Written by Leif Stenfeldt. Posted in ESX, Linux, Tips

Memory limit doesn’t accept the negative value -1048576 error

MacOS Sierra 10.12 and Safari 10.0. Reopening the ‘edit’ screen produces a Memory limit doesn’t accept the negative value -1048576 error. This was also in the previous OS X and Safari error. Reloading the page (cmd + R) fixes it, then you can reopen the edit screen and make changes.

I use Firefox instead, it´s easier.

4502 views

Wipe / clear / reset a Chromebit

Written by Leif Stenfeldt. Posted in Archive, Tips

  1. Turn off the Chromebit by removing the power cord.
  2. Put a paperclip (or pushpin) into the recovery button hole while reattaching the power cord (to turn on the device). The recovery button hole is circled below:
  3. Press Ctrl + D.
  4. Once again, put a paperclip (or pushpin) into the recovery button hole. The device reboots and displays a red exclamation point.
  5. Press Ctrl + D. The Chromebit reboots and starts the transition to developer mode. This clears all local data, a process that takes approximately 10 minutes.
    If Forced re-enrollment is enabled for the device, you’ll see a note that developer mode is blocked. This shortens the wipe process, and still allows for re-enrollment when the device automatically reboots into verified mode.

  6. At the startup screen, press the spacebar, and then press Enter to reboot the device and return to verified mode.
  7. If you’re using a managed Chromebit for your school or business, follow these steps to enroll the device.
4098 views