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
| for attr, value in validated_data.items(): | |
| setattr(instance, attr, value) | |
| instance.save() |
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
| DO $$ | |
| BEGIN | |
| IF NOT EXISTS (SELECT 1 FROM pg_catalago.pg_roles WHERE rolname = 'reader') THEN | |
| CREATE ROLE reader; | |
| END IF; | |
| END | |
| $$; | |
| GRANT SELECT ON tasks TO reader; | |
| -- |
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
| nc --recv-only -v -w 1 65.55.33.135 25 | |
| # sample response | |
| # Ncat: Version 6.40 ( http://nmap.org/ncat ) | |
| # Ncat: Connected to 65.55.33.135:25. | |
| # 220 COL004-MC6F15.hotmail.com Sending unsolicited commercial or bulk e-mail to Microsoft's computer network is prohibited. Other restrictions are found at http://privacy.microsoft.com/en-us/anti-spam.mspx. Tue, 11 Apr 2017 15:28:03 -0700 | |
| # Ncat: Idle timeout expired (1000 ms). |
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
| iconv -f GB2312 -t UTF-8 2001.txt -o 2001_u.txt | |
| iconv: illegal input sequence at position 245256667 | |
| dd if=2001.txt of=error.txt bs=1 count=10 skip=245256667 | |
| hexdump -C error.txt |
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
| # allow social media crawlers to work by redirecting them to a server-rendered static version on the page | |
| RewriteCond %{HTTP_USER_AGENT} (facebookexternalhit/[0-9]|Twitterbot|Pinterest|Google.*snippet) | |
| RewriteRule (.*) https://path_static_page [P] |
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
| Google Chrome / Firefox. test on console xpath and css selectors | |
| XPath syntax: | |
| $x("") | |
| CSS syntax: | |
| $$("") |
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
| $scope.flag = false; | |
| $scope.buttonClicked = function() { | |
| if ($scope.flag) { | |
| return; | |
| } | |
| $scope.flag = true; | |
| Service.doService.then(function(){ | |
| //this is the callback for success | |
| $scope.flag = false; | |
| }).error(function(){ |
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
| # install deps | |
| yum install gcc kernel-devel make ncurses-devel | |
| # DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL | |
| wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz | |
| tar -xvzf libevent-2.0.21-stable.tar.gz | |
| cd libevent-2.0.21-stable | |
| ./configure --prefix=/usr/local | |
| make | |
| sudo make install |
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
| sudo dpkg-reconfigure ca-certificates; | |
| sudo update-ca-certificates -f |
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
| #!/bin/bash | |
| for i in $(docker images | grep none | awk '{print $3}') ; do | |
| docker rmi --force $i | |
| done |