If you are on free plan, you might realize that you can’t upload any files larger than 100MB. This is the limit that cloudflare applies to Free plan. If you are on Enterprise , you might increase this limit to 500MB. Want over 500MB, you might need to ask cloudflare to make an exception. Cloudflare is great, but 100MB is quite small for video upload. What solution could be? – Upgrade to enterprise (oh no, i can’t afford it) – Disable the proxy – you will not benefit from cloudflare any more – Create a new direct url upload that will not go through cloudflareRead More →

I just got a new machine, it’s time to clone my git repository to this new machine. I think it will be just very simple, just use Visual Studio Code and clone it. Unfortunately, it’s not that, i had an error “Filename too long”. I did some search and the solution that it works for me is to run:  Read More →

When i use Datadog to collect tracer/span in our PHP , i realize that Datadog library does not collect the client IP address. I don’t know what the reason behind this, but not having the client IP is very hard to troubleshoot the issue. After a while i figured out the way to hack the code. The hack is to modify this file /opt/datadog-php/dd-trace-sources/bridge/_generated.php This is my modification – check the line #================My Customize codeRead More →

With puppeteer, we normally visit a website, that website has a form for us to submit the data. In the api world, there is no form for us to submit, when you visit you must embed the request data in the request. the data could be username or password or some special headers. This is easy done with curl. How can we do that with puppeteer? We can do that, Puppeteer allows us to modify the request before sending it to the server. Here is a sample code:Read More →

A sample function to use curl post data. $data=array() $data=array(); $data[“field1″]=”hello world”; $data[“user”]=”hello user”; curl_post($url,$data) function curl_post($url,$fields) { //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT, ‘Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)’); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); curl_setopt($ch,CURLOPT_POST, count($fields)); curl_setopt($ch,CURLOPT_POSTFIELDS, $fields); //some other users translate this array to string, but it will require you to convert some special chars in url such as & //execute post $result = curl_exec($ch); //close connection curl_close($ch); return $result; }Read More →

#add this line in Type 3 – ^${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+${DESTINATION_PORT} -> Record Value DESTINATION_ADDRESS (\w+.\w+.\w+) Value TYPE (\w+) Value VLAN (\w+) Value DESTINATION_PORT (\S+) Start ^Destination\s+Address\s+Address\s+Type\s+VLAN\s+Destination\s+Port -> TYPE1 ^\s+vlan\s+mac address\s+type\s+learn\s+age\s+ports -> TYPE2 ^\s+vlan\s+mac address\s+type\s+protocols\s+port -> TYPE3 ^Vlan\s+Mac Address\s+Type\s+Ports -> TYPE4 TYPE1 ^${DESTINATION_ADDRESS}\s+${TYPE}\s+${VLAN}\s+${DESTINATION_PORT} -> Record TYPE2 ^[\*|\s]\s+${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+${DESTINATION_PORT} -> Record TYPE3 ^\s+${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+${DESTINATION_PORT} -> Record ^${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+${DESTINATION_PORT} -> Record TYPE4 ^\s+${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+${DESTINATION_PORT} -> Record  Read More →

The Diamond operator is almost exclusively used in a while-loop. It allows us to iterate over the rows in all the files given on the command line. Diamond – using $_, the default variable We can make the above example even more compact by remembering that certain operation in Perl will use $_, the default variable of Perl, if no explicit variable is given. use strict; use warnings; while (<>) { print if /perl/; }  Read More →