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
var myURL = parseURL('http://abc.com:8080/dir/index.html?id=255&m=hello#top'); | |
myURL.file; // = 'index.html' | |
myURL.hash; // = 'top' | |
myURL.host; // = 'abc.com' | |
myURL.query; // = '?id=255&m=hello' | |
myURL.params; // = Object = { id: 255, m: hello } | |
myURL.path; // = '/dir/index.html' | |
myURL.segments; // = Array = ['dir', 'index.html'] | |
myURL.port; // = '8080' |
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 | |
# requires package libnotify-bin | |
# tail -n0 -f /var/log/apache2/error.log | egrep 'Notice|Warning|Error|Fatal' | while read line | |
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" |
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 | |
// See Error Handling in PHP: https://nomadphp.com/2015/02/25/nomadphp-2015-02-us-lt2/# | |
$display = function ($status, $headers = array(), $content = '') { | |
http_response_code($status); | |
foreach ($headers as $key => $value) { | |
header($key . ': ' . $value); | |
} |
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 | |
$url = 'http://maps.googleapis.com/maps/api/staticmap?'; | |
$bits = array( | |
'center' => 'Calgary Tower, Calgary, AB, Canada', | |
'zoom' => '16', | |
'size' => '800x600', | |
'maptype' => 'roadmap', | |
'markers' => 'color:0x576d4e|label:N|49.6967179,-112.8450119', | |
'sensor' => 'false', | |
); |
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
// @see https://yandex.ru/blog/mapsapi/54098 | |
// свой загрузчик данных для RemoteObjectManager | |
// отличия от базового — генерируется события загрузки данных: dataloadbefore и dataloadafter | |
ymaps.modules.define('objectManager.component.ReloadOnZoomChangeControllerWithEvents', [ | |
'util.defineClass', | |
'objectManager.component.ReloadOnZoomChangeController' | |
], function (provide, defineClass, ReloadOnZoomChangeController) { | |
var ReloadOnZoomChangeControllerWithEvents = function (remoteObjectManager) { | |
ReloadOnZoomChangeControllerWithEvents.superclass.constructor.call(this, remoteObjectManager); |
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 | |
if [[ -z $(grep dockerhost /etc/hosts) ]] | |
then | |
echo $(printf "%d." $(echo $(awk '$2 == "00000000" {print $3}' /proc/net/route) | sed 's/../0x& /g' | tr ' ' '\n' | tac) | sed 's/\.$/\n/') dockerhost >> /etc/hosts | |
fi |
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
sudo apt install dkms git | |
git clone https://github.com/cilynx/rtl88x2BU_WiFi_linux_v5.3.1_27678.20180430_COEX20180427-5959.git | |
cd rtl88x2BU_WiFi_linux_v5.3.1_27678.20180430_COEX20180427-5959 | |
VER=$(sed -n 's/\PACKAGE_VERSION="\(.*\)"/\1/p' dkms.conf) | |
sudo rsync -rvhP ./ /usr/src/rtl88x2bu-${VER} | |
sudo dkms add -m rtl88x2bu -v ${VER} | |
sudo dkms build -m rtl88x2bu -v ${VER} | |
sudo dkms install -m rtl88x2bu -v ${VER} | |
sudo modprobe 88x2bu |
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 | |
pushd ~ | |
sudo apt update | |
sudo apt upgrade | |
# remove unused | |
sudo apt remove -y thunderbird | |
sudo apt remove -y libreoffice-core |
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
"use strict"; | |
class Batcher { | |
constructor(size = 10, callback = () => {}) { | |
this.size = size; | |
this.queue = []; | |
this.callback = callback; | |
} | |
static create(size = 10, callback = () => {}) { |
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 | |
/** | |
* @see https://developers.google.com/analytics/devguides/collection/protocol/v1/?hl=ru | |
* @see https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide?hl=ru | |
* @see https://developers.google.com/analytics/devguides/collection/protocol/v1/email?hl=ru | |
* @see https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters?hl=ru | |
*/ | |
use Ramsey\Uuid\Uuid; |
OlderNewer