# timestamp now
import time
now = int(time.time())
print(now)
# timestamp to date and time
This file contains hidden or 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
# https://html.spec.whatwg.org/multipage/named-characters.html | |
\t = 	 = 	 | |
\n = 
 = 
 | |
! = ! = ! | |
" = " = " = " | |
# = # = # | |
$ = $ = $ | |
% = % = % | |
& = & = & = & |
This file contains hidden or 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
#!/usr/bin/env bash | |
API_KEY=xxx # Get it from https://my.nextdns.io/account | |
PROFILE_ID=xxxxxx # Get it from https://my.nextdns.io | |
url=https://api.nextdns.io/profiles/$PROFILE_ID/denylist | |
curl -s -H "X-Api-Key: $API_KEY" $url | jq -r '.data[] | select(.active == true) | .id' | while read -r domain; do | |
echo "Deleting $domain..." | |
curl -X DELETE -H "X-Api-Key: $API_KEY" $url/$domain |
This file contains hidden or 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
#!/usr/bin/env bash | |
API_KEY=xxx # Get it from https://my.nextdns.io/account | |
PROFILE_ID=xxxxxx # Get it from https://my.nextdns.io | |
url=https://api.nextdns.io/profiles/$PROFILE_ID/denylist | |
curl -s -H "X-Api-Key: $API_KEY" $url | jq -r '.data[] | select(.active == true) | .id' |
This file contains hidden or 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
#!/usr/bin/env bash | |
API_KEY=xxx # Get it from https://my.nextdns.io/account | |
PROFILE_ID=xxxxxx # Get it from https://my.nextdns.io | |
url=https://api.nextdns.io/profiles/$PROFILE_ID/denylist | |
tac denylist.txt | while read -r domain; do | |
echo "Adding $domain..." | |
curl -d $"{\"id\": \"$domain\"}" \ |
This file contains hidden or 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 | |
// date | |
echo "date\n"; | |
echo date('Y-m-d H:i:s'), "\n"; | |
$dt = new DateTime(); | |
echo $dt->format('Y-m-d H:i:s'), "\n\n"; | |
// gmdate (UTC date) | |
echo "gmdate\n"; |
This file contains hidden or 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 | |
/* | |
* Heart emoji: ❤️ | |
* UTF-8 bytes: E2 9D A4 EF B8 8F | |
* Code points: U+2764 U+FE0F | |
*/ | |
header('Content-Type: text/plain'); |
This file contains hidden or 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 | |
// ISO-8859-1 → UTF-8 | |
function latin1ToUtf8(string $str): string | |
{ | |
return iconv('ISO-8859-1', 'UTF-8', $str); | |
} | |
// UTF-8 → ISO-8859-1 | |
function utf8ToLatin1(string $str): string |
NewerOlder