This file contains hidden or 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
for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done |
This file contains hidden or 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 | |
//Answer #2 | |
preg_match_all('/<a(?:\s+(?:href=[\'"](?P<href>.*?)[\'"]|title=[\'"](?P<title>.*?)["\']|\w+=[\'"](?P<other_attribute_goes_here>.*?)[\'"]))+/', $str, $match,PREG_PATTERN_ORDER); | |
print_r(array('href'=>$match['href'],'title'=>$match['title'])); |
This file contains hidden or 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
function parse_git_branch () { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
RED="\[\033[31m\]" | |
YELLOW="\[\033[33m\]" | |
GREEN="\[\033[32m\]" | |
BLUE="\[\033[34m\]" | |
PURPLE="\[\033[35m\]" | |
CYAN="\[\035[36m\]" | |
NO_COLOUR="\[\033[0m\]" |
This file contains hidden or 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
IF a EQUAL TO b AND b EQUAL TO c THEN | |
PRINT 'The numbers are same'; | |
ELSE | |
IF a SMALLER THAN b THEN | |
BEGIN | |
IF a SMALLER THAN c THEN | |
PRINT a; | |
ELSE | |
PRINT c; | |
END |
This file contains hidden or 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 | |
try { | |
$db = new PDO('mysql:host=127.0.0.1;dbname=sampledb;charset=utf8', 'root', ''); | |
} catch (PDOException $e) { | |
echo $e->getMessage(); | |
} | |
$stmt = $db->query('SELECT DISTINCT(Sensor) FROM measure2'); | |
$row_count = $stmt->rowCount(); |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Geolocation</title> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"> | |
<meta charset="utf-8"> | |
<style> | |
html, body, #map-canvas { | |
height: 100%; | |
margin: 0px; |
This file contains hidden or 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
<script type="text/javascript"> | |
var loc = window.location.hash.substr(1); | |
if (loc == 'bke01') { | |
context.font = '20px Arial'; | |
context.strokeText('BKE01', 70, 330); | |
context.beginPath(); | |
context.rect(50, 300, 100, 50); | |
context.fillStyle = 'white'; | |
context.lineWidth = 2; | |
context.strokeStyle = 'red'; |
This file contains hidden or 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
<script type="text/javascript"> | |
var loc = window.location.hash.substr(1); | |
//start position | |
context.beginPath(); | |
context.arc(190, 450, 10, 0, 2 * Math.PI, false); | |
context.fillStyle = 'white'; | |
context.lineWidth = 2; | |
context.strokeStyle = 'red'; | |
context.stroke(); |
This file contains hidden or 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 | |
$host = 'localhost'; | |
$dbname = 'tutorial_pdo'; | |
$user = 'root'; | |
$pass = ''; | |
try { | |
//$dbh , database handler aka db handler | |
$dbh = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass); |
This file contains hidden or 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
CREATE TABLE users ( | |
id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, | |
username VARCHAR(20) NOT NULL, | |
full_name VARCHAR(80) NOT NULL, | |
password VARCHAR(40) NOT NULL, | |
salt VARCHAR(40) DEFAULT NULL, | |
email VARCHAR(80) NOT NULL | |
) | |
ENGINE InnoDB; |