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
<TaskerData sr="" dvi="1" tv="6.1.32"> | |
<Task sr="task4"> | |
<cdate>1701381152290</cdate> | |
<edate>1701383416926</edate> | |
<id>4</id> | |
<nme>ChatGPT Voice</nme> | |
<pri>100</pri> | |
<Action sr="act0" ve="7"> | |
<code>25</code> | |
<Int sr="arg0" val="0"/> |
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 | |
// API details: https://wiki.openstreetmap.org/wiki/Overpass_API | |
// Define your bounding box [south latitude, west longitude, north latitude, east longitude] | |
$bbox = array(51.28, -0.489, 55.81, 1.76); // Example bounding box around London | |
// Construct the Overpass query | |
$query = "[out:json];(node[\"place\"=\"city\"](".implode(',', $bbox).");node[\"place\"=\"town\"](".implode(',', $bbox)."););out;"; |
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 | |
# Check if the correct number of arguments is provided | |
if [ "$#" -ne 2 ]; then | |
echo "Usage: $0 '<prompt>' '<image_url>'" | |
exit 1 | |
fi | |
PROMPT=$1 | |
IMAGE_URL=$2 |
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 | |
function strip_word_html($text, $allowed_tags = '<b><i><sup><sub><em><strong><u><br>') | |
{ | |
mb_regex_encoding('UTF-8'); | |
//replace MS special characters first | |
$search = array('/‘/u', '/’/u', '/“/u', '/”/u', '/—/u'); | |
$replace = array('\'', '\'', '"', '"', '-'); | |
$text = preg_replace($search, $replace, $text); | |
//make sure _all_ html entities are converted to the plain ascii equivalents - it appears | |
//in some MS headers, some html entities are encoded and some aren't |
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 | |
// dangerously simple PHP regular expression URL router | |
// requires a mod_rewrite like "RewriteRule . /index.php [L]" | |
function get($url, $callback) { | |
$matches = array(); | |
if (preg_match('~' . $url . '~', $_SERVER['REQUEST_URI'], $matches)) { | |
echo call_user_func_array($callback, $matches); | |
die(); | |
} |
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 | |
conflicts=`git diff --cached --name-only -S'<<<<<<'` | |
for i in `git diff --cached --name-only | grep '.php'`; | |
do | |
thisphperror=`php -l $i | grep -v 'No syntax errors detected in'` | |
if [ -n "$thisphperror" ]; then | |
echo "PHP errors added in file: " $i |
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
# HTTP Status Cats | |
# Apache (htaccess) config created by @dave1010 | |
# Licensed CC BY 2.0 | |
# Images CC BY 2.0, from GirlieMac's photostream: | |
# http://www.flickr.com/photos/girliemac/sets/72157628409467125/with/6508023065/ | |
# Usage: copy save this file as .htaccess or add it to your httpd.conf | |
ErrorDocument 404 '<a href="http://www.flickr.com/photos/girliemac/6508022985/" title="404 - Not Found by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7172/6508022985_b22200ced0.jpg" width="500" height="400" alt="404 - Not Found"></a>' |
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 | |
# use ubuntu's notification system to let us know when there's something new in the apache error log | |
tail -n0 -f /var/log/apache2/error.log | while read line | |
do | |
body=`echo $line | cut -f 9- -d ' '` | |
notify-send -c im.received -i error "Apache / PHP error" "$body" | |
done |
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 | |
function deResolveSymlinks($file) | |
{ | |
$included = get_included_files(); | |
if(array_search($file, $included) !== false) { | |
return $file; | |
} | |
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 | |
class MyClass { | |
public function __toString() { | |
try { | |
return $this->render(); | |
} catch(Exception $e) { | |
// the __toString method isn't allowed to throw exceptions | |
// so we turn them into an error instead | |
trigger_error($e->getMessage() . "\n" . $e->getTraceAsString(), E_USER_ERROR); |
NewerOlder