Skip to main content

LAMP / LEMP development note 30-Sept-2019

Count Apache's (httpd) concurrent connections
https://www.2daygeek.com/linux-check-apache-concurrent-connections-netstat-ss-command/


$htpasswd -b -c ~/temp/password admin test101

https://www.networkworld.com/article/2874387/mission-impossible-memorizing-ipv6-addresses.html

 Chrome & Firfox Dark mode seem cool.

https://stackoverflow.com/questions/19646567/is-there-a-way-to-get-client-connections-count-in-aws-elb

ELB actually runs on EC2 (?), which would only make sense, and would explain why it can't scale up extremely rapidly in response to traffic spikes.

YOU CAN’T PROTECT WHAT YOU CAN’T SEE
https://medium.com/tenable-techblog/lessons-from-aws-nlb-timeouts-5028a8f65dda

https://stackoverflow.com/questions/6375654/how-to-add-date-string-to-each-line-of-a-continuously-written-log-file

Difference between ESTABLISHED and LISTENING
https://askubuntu.com/questions/854354/difference-between-established-and-listening
https://users.cs.northwestern.edu/~agupta/cs340/project2/TCPIP_State_Transition_Diagram.pdf


 Ton of document ab Linux bash
 https://ocaml.github.io/ocamlunix/pipes.html

https://ocaml.github.io/ocamlunix/ocamlunix.html

 https://ocaml.github.io/ocamlunix/ocamlunix.pdf

 https://github.com/ocaml/ocamlunix/

 $ date -Iseconds
2016-09-09T12:18:23+0200

 awk -v var="$TIMESTAMP"

Queue
 https://stackoverflow.com/questions/18396452/design-a-datastructure-to-return-the-number-of-connections-to-a-web-server-in-la

htdigest [ -c ] passwdfile realm username

https://stackoverflow.com/questions/600079/how-do-i-clone-a-subdirectory-only-of-a-git-repository

http://www.andymboyle.com/2011/11/02/quick-csv-to-json-parser-in-python/
https://www.codementor.io/garethdwyer/flask-vs-django-why-flask-might-be-better-4xs7mdf8v

https://stackoverflow.com/questions/419163/what-does-if-name-main-do

http://www.andymboyle.com/2011/11/02/quick-csv-to-json-parser-in-python/

https://realpython.com/python-testing/

Damn encoding

function w1250_to_utf8($text) {
    // map based on:
    // http://konfiguracja.c0.pl/iso02vscp1250en.html
    // http://konfiguracja.c0.pl/webpl/index_en.html#examp
    // http://www.htmlentities.com/html/entities/
    $map = array(
        chr(0x8A) => chr(0xA9),
        chr(0x8C) => chr(0xA6),
        chr(0x8D) => chr(0xAB),
        chr(0x8E) => chr(0xAE),
        chr(0x8F) => chr(0xAC),
        chr(0x9C) => chr(0xB6),
        chr(0x9D) => chr(0xBB),
        chr(0xA1) => chr(0xB7),
        chr(0xA5) => chr(0xA1),
        chr(0xBC) => chr(0xA5),
        chr(0x9F) => chr(0xBC),
        chr(0xB9) => chr(0xB1),
        chr(0x9A) => chr(0xB9),
        chr(0xBE) => chr(0xB5),
        chr(0x9E) => chr(0xBE),
        chr(0x80) => '€',
        chr(0x82) => '‚',
        chr(0x84) => '„',
        chr(0x85) => '…',
        chr(0x86) => '†',
        chr(0x87) => '‡',
        chr(0x89) => '‰',
        chr(0x8B) => '‹',
        chr(0x91) => '‘',
        chr(0x92) => '’',
        chr(0x93) => '“',
        chr(0x94) => '”',
        chr(0x95) => '•',
        chr(0x96) => '–',
        chr(0x97) => '—',
        chr(0x99) => '™',
        chr(0x9B) => '’',
        chr(0xA6) => '¦',
        chr(0xA9) => '©',
        chr(0xAB) => '«',
        chr(0xAE) => '®',
        chr(0xB1) => '±',
        chr(0xB5) => 'µ',
        chr(0xB6) => '¶',
        chr(0xB7) => '·',
        chr(0xBB) => '»',
    );
    return html_entity_decode(mb_convert_encoding(strtr($text, $map), 'UTF-8', 'ISO-8859-2'), ENT_QUOTES, 'UTF-8');
}
https://www.php.net/manual/en/function.mb-convert-encoding.php


https://smallbusiness.chron.com/microsoft-excel-wont-show-japanese-characters-77317.html

https://www.php.net/manual/en/language.operators.errorcontrol.php
Is there any equivalent in Python ?

https://stackoverflow.com/questions/1088387/what-specific-productivity-gains-do-vim-emacs-provide-over-gui-text-editors
https://stackoverflow.com/questions/14132003/is-emacs-worth-learning

https://github.com/jazzband/django-pipeline/issues/602
https://stackoverflow.com/questions/17353213/init-for-unittest-testcase
https://stackoverflow.com/questions/16870663/how-do-i-validate-a-date-string-format-in-python

https://stackoverflow.com/questions/3501382/checking-whether-a-variable-is-an-integer-or-not

Testing IP based access
To test multiple IP access, for example for IP connection count, order, we can:
- Use PC + mobile (with Mobile 3G/4G/5G) to test
- PC + mobile (with VPN like Orbot)
- PC with VPN + mobile Wifi (same network)
- A PC + a VPS server  (can be temporary created or permanent one, delete after test if not needed)


https://mortada.net/can-integer-operations-overflow-in-python.html
https://stackoverflow.com/questions/2484156/is-str-replace-replace-ad-nauseam-a-standard-idiom-in-python
https://stackoverflow.com/questions/9573244/how-to-check-if-the-string-is-empty
https://stackoverflow.com/questions/21388541/how-do-you-check-in-python-whether-a-string-contains-only-numbers

https://stackoverflow.com/questions/38398018/ip-address-and-command-logs-for-git-clone-pull-and-push

Comments

Popular posts from this blog

AWS Elasticache Memcached connection

https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/accessing-elasticache.html#access-from-outside-aws http://hourlyapps.blogspot.com/2010/06/examples-of-memcached-commands.html Access memcached https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/GettingStarted.AuthorizeAccess.html Zip include hidden file https://stackoverflow.com/questions/12493206/zip-including-hidden-files phpmemcachedadmin ~ phpMyAdmin or phpPgAdmin ... telnet mycachecluster.eaogs8.0001.usw2.cache.amazonaws.com 11211 stats items stats cachedump 27 100 https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/VPCs.EC.html https://lzone.de/cheat-sheet/memcached VPC ID Security Group ID (sg-...) Cluster: The identifier for the cluster memcached1 Creation Time: The time (UTC) when the cluster was created January 9, 2019 at 11:47:16 AM UTC+7 Configuration Endpoint: The configuration endpoint of the cluster memcached1.ahgofe.cfg.usw1.cache.amazonaws.com:11211 St...

Simulate Fail2ban on Apache request spam with mod_evasive limitipconn ...

https://en.wikipedia.org/wiki/Manchu_alphabet https://en.wikipedia.org/wiki/Sweet_potato https://en.wikipedia.org/wiki/New_World_crops https://www.mdpi.com/journal/energies http://www.cired.net/publications/cired2007/pdfs/CIRED2007_0342_paper.pdf https://www.davidpashley.com/articles/writing-robust-shell-scripts/ trap command https://en.wikipedia.org/wiki/Race_condition https://unix.stackexchange.com/questions/172541/why-does-exit-1-not-exit-the-script exit 1 not work it seem { } brace bound fixed it. cat access_log | cut -d ' ' -f 1 > ip1 sort -n -t. -k1,1 -k2,2 -k3,3 -k4,4 | uniq -c | sort -n -r -s https://unix.stackexchange.com/questions/246104/unix-count-unique-ip-addresses-sort-them-by-most-frequent-and-also-sort-them https://stackoverflow.com/questions/20164696/how-to-block-spam-and-spam-bots-for-good-with-htaccess  Code: ------------------------------------------------------------------- #Block Spam Bots and Spam on your website #Block proxies...

Notes Windows 10 Virtualbox config, PHP Storm Japanese, custom PHP, Apache build, Postgresql

 cmd => Ctrl + Shift + Enter mklink "C:\Users\HauNT\Videos\host3" "C:\Windows\System32\drivers\etc\hosts" https://www.quora.com/How-to-create-a-router-in-php https://serverfault.com/questions/225155/virtualbox-how-to-set-up-networking-so-both-host-and-guest-can-access-internet 1 NAT + 1 host only config https://unix.stackexchange.com/questions/115464/how-to-properly-set-up-2-network-interfaces-in-centos-running-in-virtualbox DEVICE=eth0 TYPE=Ethernet #BOOTPROTO=dhcp BOOTPROTO=none #IPADDR=10.9.11.246 #PREFIX=24 #GATEWAY=10.9.11.1 #IPV4_FAILURE_FATAL=yes #HWADDR=08:00:27:CC:AC:AC ONBOOT=yes NAME="System eth0" [root@localhost www]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 # Advanced Micro Devices, Inc. [AMD] 79c970 [PCnet32 LANCE] DEVICE=eth1 IPADDR=192.168.56.28 <= no eff => auto like DHCP #GATEWAY=192.168.56.1 #BOOTPROTO=dhcp BOOTPROTO=static <= no eff ONBOOT=yes HWADDR=08:00:27:b4:20:10 [root@localhost www]# ...