[Update 2024] - Take a look at Drupal at your fingertips. Lot's of great stuff there.
// Load file object
$file = File::load($fid);| <?php | |
| $cn = \Drupal\Core\Database\Database::getConnection('default', 'default'); | |
| // This is prefix you want your tables to remove. | |
| $prefix = 's3cr3t_'; | |
| // Read all tables | |
| $result = $cn->query("SHOW TABLES"); |
| <?php | |
| $date = date('Y-m-d'); | |
| if ($argv[1]) { | |
| $date = $argv[1]; | |
| } | |
| // Get all posts for this montn posts | |
| $biggest_timestamp = strtotime($date) - 60; | |
| $selected_month = date('Ym', strtotime($date)); |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>title</title> | |
| <link rel="stylesheet" href="style.css"> | |
| <script src="script.js"></script> | |
| </head> | |
| <body> | |
| <!-- page content --> |
| <?php | |
| $e = new \Exception; | |
| var_dump($e->getTraceAsString()); | |
| #2 /usr/share/php/PHPUnit/Framework/TestCase.php(626): SeriesHelperTest->setUp() | |
| #3 /usr/share/php/PHPUnit/Framework/TestResult.php(666): PHPUnit_Framework_TestCase->runBare() | |
| #4 /usr/share/php/PHPUnit/Framework/TestCase.php(576): PHPUnit_Framework_TestResult->run(Object(SeriesHelperTest)) | |
| #5 /usr/share/php/PHPUnit/Framework/TestSuite.php(757): PHPUnit_Framework_TestCase->run(Object(PHPUnit_Framework_TestResult)) | |
| #6 /usr/share/php/PHPUnit/Framework/TestSuite.php(733): PHPUnit_Framework_TestSuite->runTest(Object(SeriesHelperTest), Object(PHPUnit_Framework_TestResult)) |
| #!/bin/bash | |
| # Fonts | |
| # https://askubuntu.com/questions/528928/how-to-do-underline-bold-italic-strikethrough-color-background-and-size-i | |
| echo -e '\e[1mbold\e[22m' | |
| echo -e '\e[2mdim\e[22m' | |
| echo -e '\e[3mitalic\e[23m' | |
| echo -e '\e[4munderline\e[24m' | |
| echo -e '\e[4:1mthis is also underline (new in 0.52)\e[4:0m' |
| docker run -it --rm mysql mysql -hsome.mysql.host -usome-mysql-user -p |
| # -*- coding: UTF-8 -*- | |
| import sys | |
| import json | |
| import urllib2 | |
| def color(this_color, string): | |
| return "\033[" + this_color + "m" + string + "\033[0m" |
[Update 2024] - Take a look at Drupal at your fingertips. Lot's of great stuff there.
// Load file object
$file = File::load($fid);| #!/bin/sh | |
| # Disable the NMI watchdog | |
| echo '0' > '/proc/sys/kernel/nmi_watchdog'; | |
| # Runtime power management for I2C devices | |
| for i in /sys/bus/i2c/devices/*/device/power/control ; do | |
| echo auto > ${i} | |
| done |