force bind/named secondary to reload from primary
rndc retransfer domain.name
uniq -f (ignore first n fields – or with rev last n fields)
#find web access log files in backups – only take one from each date – put them together in date order in one file
#!/bin/bash
FOO=`find /backups/*/a/var/log/nginx -name "access.log*" -ls|cut -b 60-|sort -k 1 -k 2 -k 3|rev|uniq -f 1|rev|awk '{ print $4 }'`
for file in `ls -rt $FOO`; do
gzip -cd $file|grep website.com >> /var/tmp/joined.access.log
done
lineageOS 20.0 TheMuppets blueline roomservice.xml
.repo/local_manifests/roomservice.xml
<?xml version="1.0" encoding="UTF-8"?> <manifest> <project path="device/google/blueline" remote="github" name="LineageOS/android _device_google_blueline" revision="lineage-20" /> <project path="device/google/crosshatch" remote="github" name="LineageOS/andro id_device_google_crosshatch" revision="lineage-20" /> <project path="kernel/google/msm-4.9" remote="github" name="LineageOS/android_ kernel_google_msm-4.9" revision="lineage-20" /> <project path="packages/apps/ElmyraService" remote="github" name="LineageOS/an droid_packages_apps_ElmyraService" revision="lineage-20.0" /> <project name="TheMuppets/proprietary_vendor_google_blueline" path="vendor/goo gle/blueline" remote="github" revision="lineage-20" /> <remote name="gitlab" fetch="https://gitlab.com" /> <project name="the-muppets/proprietary_vendor_firmware" path="vendor/firmware" remote="gitlab" revision="lineage-20" depth="1" /> </manifest>
dynamic/live search box with php, javascript, mysql
I went through a bunch of iterations with this a couple years ago and didn’t get it working.
This is the second one I tried recently and was able to get what I wanted for hyperlinked results.
https://www.codingcage.com/2016/12/autocomplete-search-with-href-link-php.html
code blobs for posterity:
database:
--
-- Database: `codingcage`
--
-- --------------------------------------------------------
--
-- Table structure for table `tbl_posts`
--
CREATE TABLE IF NOT EXISTS `tbl_posts` (
`postID` int(11) NOT NULL AUTO_INCREMENT,
`postTitle` varchar(255) NOT NULL,
`postUrl` varchar(255) NOT NULL,
PRIMARY KEY (`postID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
--
-- Dumping data for table `tbl_posts`
--
INSERT INTO `tbl_posts` (`postID`, `postTitle`, `postUrl`) VALUES
(1, 'Simple jQuery Add, Update, Delete with PHP and MySQL', 'http://goo.gl/IL6NTr'),
(2, '15 Free Bootstrap Admin Themes Demo and Download', 'http://goo.gl/1dBwEy'),
(3, 'Easy Ajax Image Upload with jQuery, PHP', 'http://goo.gl/jXZ6LY'),
(4, 'How to Send HTML Format eMails in PHP using PHPMailer', 'http://goo.gl/kQrzJP'),
(5, 'Ajax Bootstrap Signup Form with jQuery PHP and MySQL', 'http://goo.gl/yxKrha'),
(6, 'Submit PHP Form without Page Refresh using jQuery, Ajax', 'http://goo.gl/14vlBe'),
(7, 'How to Convert MySQL Rows into JSON Format in PHP', 'http://goo.gl/qgOiwB'),
(8, 'Designing Bootstrap Signup Form with jQuery Validation', 'http://goo.gl/nECERc'),
(9, 'Upload, Insert, Update, Delete an Image using PHP MySQL', 'http://goo.gl/HRJrDD'),
(10, 'Login Registration with Email Verification, Forgot Password using PHP', 'http://goo.gl/O9FKN1');
php:
<?php
$DBhost = "localhost";
$DBuser = "root";
$DBpass = "";
$DBname = "codingcage";
try {
$DBcon = new PDO("mysql:host=$DBhost;dbname=$DBname",$DBuser,$DBpass);
} catch(PDOException $ex){
die($ex->getMessage());
}
$keyword = trim($_REQUEST['term']); // this is user input
$sugg_json = array(); // this is for displaying json data as a autosearch suggestion
$json_row = array(); // this is for stroring mysql results in json string
$keyword = preg_replace('/\s+/', ' ', $keyword); // it will replace multiple spaces from the input.
$query = 'SELECT postID, postTitle, postUrl FROM tbl_posts WHERE postTitle LIKE :term'; // select query
$stmt = $DBcon->prepare( $query );
$stmt->execute(array(':term'=>"%$keyword%"));
if ( $stmt->rowCount()>0 ) {
while($recResult = $stmt->fetch(PDO::FETCH_ASSOC)) {
$json_row["id"] = $recResult['postUrl'];
$json_row["value"] = $recResult['postTitle'];
$json_row["label"] = $recResult['postTitle'];
array_push($sugg_json, $json_row);
}
} else {
$json_row["id"] = "#";
$json_row["value"] = "";
$json_row["label"] = "Nothing Found!";
array_push($sugg_json, $json_row);
}
$jsonOutput = json_encode($sugg_json, JSON_UNESCAPED_SLASHES);
print $jsonOutput;
html:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0">
<title>AutoComplete Example in PHP MySQL</title>
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
</head>
<body>
<div class="container">
<div class="page-header">
<h3 style="color:#00a2d1; font-size:30px; font-family: Impact, Charcoal, sans-serif; text-align: center;">AutoComplete Search with Href Link in PHP MySQL</h3>
</div>
<div class="row">
<div class="col-lg-12 text-center">
<div class="col-lg-offset-2">
<form>
<div class="form-group">
<div class="input-group">
<input id="txtSearch" class="form-control input-lg" type="text" placeholder="Search for PHP, MySQL, Ajax and jQuery" />
<div class="input-group-addon"><i class="glyphicon glyphicon-search"></i></div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<script>
$(document).ready(function(){
$('#txtSearch').autocomplete({
source: "post_search.php",
minLength: 2,
select: function(event, ui) {
var url = ui.item.id;
if (url != '#') {
location.href = url
}
},
open: function(event, ui) {
$(".ui-autocomplete").css("z-index", 1000)
}
})
});
</script>
</body>
</html>
This site was the first one that I got working – but I wasn’t happy with using it for hyperlinked results.
https://codeforgeek.com/ajax-search-box-php-mysql/
code blobs for posterity:
WARNING: sanitize your input and prevent code injection attacks
html file:
<html> <head> <title>Ajax Search Box using PHP and MySQL</title> <scriptsrc="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"> </script> <script src="typeahead.min.js"></script> </head> <body> <inputtype="text" name="typeahead"> </body> <script> $(document).ready(function(){ $('input.typeahead').typeahead({ name: 'typeahead', remote:'search.php?key=%QUERY', limit : 10 }); }); </script> </html>
<?php
$key=$_GET['key'];
$array = array();
$con=mysqli_connect("localhost","root","","demos");
$query=mysqli_query($con, "select * from cfg_demos where title LIKE '%{$key}%'");
while($row=mysqli_fetch_assoc($query))
{
$array[] = $row['title'];
}
echo json_encode($array);
mysqli_close($con);
?>
nominatim php-intl error message Class Transliterator not found code 0
ubuntu package management decided I didn’t need the current version of php-intl which was running in apache so nominatim fell on it’s face with this error message
“error”
“message” => Class “Transliterator” not found
“code” => 0))
I found the current version of php running in apache with this (put it in a file under the webserver and point a browser at it
<?php phpinfo();
and then install the relevant version of php-intl
Ubuntu apt spam
Is the recent ubuntu apt spam getting you down – just move or remove
/etc/apt/apt.conf.d/20apt-esm-hook.conf
and apt goes back to doing it’s job without spam.
Updates to ubuntu-advantage-tools will restore it…
so for a longer term solution check out: https://askubuntu.com/questions/1371014/what-is-ubuntu-advantage-doing-on-my-fully-supported-20-04-box-what-is-it-che
control of domain(s) associated with nextcloud snap
associate domain names with your nextcloud snap
$ nextcloud.occ config:system:set trusted_domains 1 \ --value=nextcloud.foo.bar $ nextcloud.occ config:system:set trusted_domains 2 \ --value=192.168.1.11
and then get new certs from letsencrypt
$ nextcloud.enable-https lets-encrypt
from:
https://medium.com/@dbclin/administrating-nextcloud-as-a-snap-4eb43ca6d095
android games without ads or in-app-purchases
solitaire
https://play.google.com/store/apps/details?id=com.IskoGames.SolitaireCardGames&hl=en&gl=us $0
https://play.google.com/store/apps/details?id=com.brasskeysoftware.yukongold&hl=en&gl=us $1.99
tetris
https://play.google.com/store/apps/details?id=com.voriacorporation.tetris&hl=en&gl=us $0
https://play.google.com/store/apps/details?id=woodblock.puzzle.brick.tetris&hl=en&gl=us $0
Also some games on f-droid like 2048
Google Fi Dialer Codes
Here are a list of dialer codes that can be used with Google Fi. These codes shouldn’t be used unless you are aware that they may impact the way your Fi phone switches between carriers.
Carrier Selection
The following options are only available for “Designed for Fi” phones. They will not work on the iPhone or “Compatible with Fi” phones because they are T-Mobile only. See which class of phone you have here.
ALPHA CODE | DIALER CODE | DESCRIPTION |
FI AUTO | *#*#342886#*#* | Set carrier selection to automatic. |
FI NEXT | *#*#346398#*#* | Select Next Carrier |
FI SPR | *#*#34777#*#* | Select Sprint for 2 hours |
FI TMO | *#*#34866#*#* | Select T-Mobile 2 hours |
FI USC | *#*#34872#*#* | Select US Cellular 2 hours |
FI SIMON | *#*#3474666#*#* | Select Three (UK only) |
Service Codes
ALPHA CODE | DIALER CODE | DESCRIPTION |
FIXME | *#*#34963#*#* | Force reactivation |
FI INFO | *#*#344636#*#* | Get information about the current network. |
INFO | *#*#4636#*#* | Get general phone information. |
DEBUG | *#*#33284#*#* | Phone Debug Options |
PRL | *#*#775#*#* | Force download of Preferred Roaming List (Sprint) |
PRL | *228 | Force download of Preferred Roaming List (US Cellular) |
FI ROAM | *#*#347626#*#* | Turn on International Roaming |
SWITCH SIM |
*#*#794824746#*#* | Switch to / from eSim. |