initial commit
This commit is contained in:
28
PHP_Scripts/JS_Keypress/keypress.html
Normal file
28
PHP_Scripts/JS_Keypress/keypress.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<html>
|
||||
<head>
|
||||
<script language="JavaScript">
|
||||
function keyHandler(e)
|
||||
{
|
||||
var pressedKey;
|
||||
if (document.all)
|
||||
{
|
||||
e = window.event;
|
||||
}
|
||||
if (document.layers || e.which)
|
||||
{
|
||||
pressedKey = e.which;
|
||||
}
|
||||
if (document.all)
|
||||
{
|
||||
pressedKey = e.keyCode;
|
||||
}
|
||||
pressedCharacter = String.fromCharCode(pressedKey);
|
||||
alert(' Character = ' + pressedCharacter + ' [Decimal value = ' + pressedKey + ']');
|
||||
}
|
||||
document.onkeyup = keyHandler;
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
Press any key.
|
||||
</body>
|
||||
</html>
|
21
PHP_Scripts/check number of cpu/num_processors.php
Normal file
21
PHP_Scripts/check number of cpu/num_processors.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$cmd = "uname";
|
||||
$OS = strtolower(trim(shell_exec($cmd)));
|
||||
|
||||
switch($OS){
|
||||
case('linux'):
|
||||
$cmd = "cat /proc/cpuinfo | grep processor | wc -l";
|
||||
break;
|
||||
|
||||
case('freebsd'):
|
||||
$cmd = "sysctl -a | grep 'hw.ncpu' | cut -d ':' -f2";
|
||||
break;
|
||||
|
||||
default:
|
||||
unset($cmd);
|
||||
}
|
||||
|
||||
if ($cmd != ''){
|
||||
$cpuCoreNo = intval(trim(shell_exec($cmd)));
|
||||
}
|
||||
?>
|
50
PHP_Scripts/extract_pdf/extract.php
Normal file
50
PHP_Scripts/extract_pdf/extract.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/* This file is meant to run from the CLI/Shell
|
||||
* it extracts the first page of a pdf file and saves to
|
||||
* jpg with same name + _thumb pic being 240pix wide
|
||||
* Author Carsten Jensen aka Tomse @ http://awesome.commodore.me
|
||||
* Copyright (C) 2012 Carsten Jensen
|
||||
* This is distributed under GNU GPLv2
|
||||
*/
|
||||
|
||||
/* Requirements:
|
||||
* php (cli/shell version) / or as apache site
|
||||
* imagemagick module
|
||||
*/
|
||||
|
||||
/* Usage:
|
||||
* Run the file from the browser (apache setup)
|
||||
* or from cli : php -f extract
|
||||
* thumb files will be saved in same dir as pdf files
|
||||
*/
|
||||
|
||||
// Edit the path here where your PDF files are stored.
|
||||
$dir = "./pages/";
|
||||
// Edit width in pixels to change sizes
|
||||
$size = 240;
|
||||
|
||||
// Replace false with true to make the script work
|
||||
$work = false;
|
||||
|
||||
|
||||
// code is here.. nothing more to modify
|
||||
// -------------------------------------
|
||||
if ($work == true)
|
||||
{
|
||||
$files = glob($dir . "*.[pP][dD][fF]");
|
||||
foreach($files as $v)
|
||||
{
|
||||
$filename = substr($v, 0, strlen($v) - 4);
|
||||
$thumb = new Imagick();
|
||||
$thumb->setResolution(300, 300);
|
||||
$thumb->readImage($v ."[0]");
|
||||
$thumb->setImageFormat('jpeg');
|
||||
$thumb->setImagecompression(imagick::COMPRESSION_JPEG);
|
||||
$thumb->setImageCompressionQuality(75);
|
||||
$thumb->resizeImage($size, 1024, imagick::FILTER_LANCZOS, 1, true);
|
||||
$thumb->writeImage($filename . "_thumb.jpg");
|
||||
$thumb->clear();
|
||||
$thumb->destroy();
|
||||
}
|
||||
}
|
||||
?>
|
BIN
PHP_Scripts/vid to html5/ffmpeg.exe
Normal file
BIN
PHP_Scripts/vid to html5/ffmpeg.exe
Normal file
Binary file not shown.
7
PHP_Scripts/vid to html5/vids.cmd
Normal file
7
PHP_Scripts/vid to html5/vids.cmd
Normal file
@@ -0,0 +1,7 @@
|
||||
for %%i in (vids\*.*) DO (
|
||||
ffmpeg -i %%i -ss 180 -vframes 1 -r 1 -s 320x200 -f image2 output\%%~ni.jpg
|
||||
ffmpeg -i %%i -s 320x200 -acodec libvorbis -f webm -b:v 150k -bufsize 16k -vcodec libvpx output\%%~ni.webm -s 320x200 -acodec libmp3lame -b:v 150k -bufsize 16k -vcodec libx264 output\%%~ni.mp4
|
||||
|
||||
)
|
||||
|
||||
pause
|
Reference in New Issue
Block a user