This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CONFIG_FILE="/root/config.txt" | |
source $CONFIG_FILE | |
export DISPLAY=:0 | |
export GPU_MAX_ALLOC_PRECENT=100 | |
export GPU_USE_SYNC_OBJECTS=0 | |
export GPU_SINGLE_ALLOC_PERCENT=100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
osSeries=none | |
# OS Series | |
MODULE_FGLRX=`dpkg -l | grep fglrx | wc -l` | |
if [ $MODULE_FGLRX -gt 0 ]; then | |
osSeries=R | |
fi | |
MODULE_AMDGPU=`lsmod | grep amdgpu | wc -l` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Kadane's algorithm for finding the MAXIMUM contiguous subsequence in a one-dimensional sequence. | |
* @author thachp | |
* Attributions: | |
* http://www.algorithmist.com/index.php/Kadane's_Algorithm | |
* http://www.turb0js.com/a/Kadane's_algorithm# | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Quick Sort. It is very practical. The PHP sort() is a quick sort. | |
* Average Case: O(nlong(n)) | |
* Worst Case: O(n^2) but can be avoided by randomize the pivot. | |
* @author thachp | |
*/ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* SPLStack provide functionalities of a stack implemented using a doubly linked list. | |
* Purpose of this is to understand how to implement stack in PHP. | |
* @author thachp | |
*/ | |
$stack = new SplStack(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implement a stack using array. LIFO. No SPL. | |
* @author thachp | |
*/ | |
class Stack { | |
// dynamic type | |
private $_stack = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add number without using any arithmetic operators. | |
* @author thachp * | |
**/ | |
// add & subject | |
function add($a, $b) { | |
if ($b === 0) return $a; | |
$sum = $a ^ $b; // add |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Singly LinkList in PHP. For fun! | |
* @author thachp | |
**/ | |
class Node { | |
public $data = null; | |
public $next = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<phpunit bootstrap="bootstrap.php" | |
colors="true" | |
convertErrorsToExceptions="true" | |
convertNoticesToExceptions="true" | |
convertWarningsToExceptions="true" | |
processIsolation="false" | |
stopOnFailure="false" | |
syntaxCheck="false" | |
verbose="true"> | |
</phpunit> |
NewerOlder