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 | |
$output = array(); | |
$q = $modx->newQuery('modTemplateVarResource'); | |
$q->select('DISTINCT(`modTemplateVarResource`.`value`)'); | |
$q->innerJoin('modTemplateVar', 'tv', "tv.id = modTemplateVarResource.tmplvarid"); | |
$q->innerJoin('modResource', 'res', 'res.id=modTemplateVarResource.contentid'); | |
$q->where(array( | |
'tv.name' => 'category', | |
'res.context_key' => $modx->resource->context_key, |
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
function bytes($a) { | |
$unim = array("B","KB","MB","GB","TB","PB"); | |
$c = 0; | |
while ($a>=1024) { | |
$c++; | |
$a = $a/1024; | |
} | |
return number_format($a,($c ? 2 : 0),",",".")." ".$unim[$c]; | |
} |
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
PS1='\[\e[1;32m\]\u\[\e[1;32m\]@\[\033[1;32m\]\h \[\e[1;32m\]\w\[\e[m\] \[\e[1;32m\]\$\[\e[m\] \[\e[1;37m\]' |
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
docker run -d -p443:443 --name=mt -e SECRET=935ddceb2f6bbbb78363b224099f75c8 -e TAG=d482b679405543ad111c0f9a6bd3c2c8 --privileged --restart=always -v proxy-config:/data telegrammessenger/proxy:latest |
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
function json_response($data = array()) { | |
// clear the old headers | |
header_remove(); | |
// set the actual code | |
http_response_code(200); | |
// set the header to make sure cache is forced | |
header("Cache-Control: no-transform,public,max-age=300,s-maxage=900"); | |
// treat this as json | |
header('Content-Type: application/json'); | |
header('Status: 200'); |
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 | |
api='' #api key | |
chat_id='' #chat_id | |
curl -d "chat_id=$chat_id&text=$1" https://api.telegram.org/bot$api/sendMessage > /dev/null 2>&1 |
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
find www/ -type f -printf '%TY-%Tm-%Td %TT %p\n' | sort -r > dates.txt |
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
RewriteEngine on | |
RewriteCond %{HTTP_USER_AGENT} android [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} opera\ mini [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} blackberry [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} iphone [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} (pre\/|palm\ os|palm|hiptop|avantgo|plucker|xiino|blazer|elaine) [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} (iris|3g_t|windows\ ce|opera\ mobi|windows\ ce;\ smartphone;|windows\ ce;\ iemobile) [NC,OR] | |
RewriteCond %{HTTP:Accept} (text\/vnd\.wap\.wml|application\/vnd\.wap\.xhtml\+xml) [NC,OR] | |
RewriteCond %{HTTP:Profile} .+ [NC,OR] | |
RewriteCond %{HTTP:Wap-Profile} .+ [NC,OR] |
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 | |
name=$1 | |
modx=$2 | |
mkdir $name && | |
cd $name && | |
mkdir html psd && | |
cd html && | |
touch index.html |
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
if( window.history && window.history.pushState ){ | |
history.pushState( "nohb", null, "" ); | |
$(window).on( "popstate", function(event){ | |
if( !event.originalEvent.state ){ | |
history.pushState( "nohb", null, "" ); | |
return; | |
} | |
}); | |
} |
OlderNewer