filesize

How to get remote file size from a shell script?

穿精又带淫゛_ 提交于 2019-11-28 16:38:06
Is there a way to get the size of a remote file like http://api.twitter.com/1/statuses/public_timeline.json in shell script? codaddict You can download the file and get its size. But we can do better. Use curl to get only the response header using the -I option. In the response header look for Content-Length: which will be followed by the size of the file in bytes. $ URL="http://api.twitter.com/1/statuses/public_timeline.json" $ curl -sI $URL | grep -i Content-Length Content-Length: 134 To get the size use a filter to extract the numeric part from the output above: $ curl -sI $URL | grep -i

Better way to convert file sizes in Python

烈酒焚心 提交于 2019-11-28 16:04:01
I am using a library that reads a file and returns its size in bytes. This file size is then displayed to the end user; to make it easier for them to understand it, I am explicitly converting the file size to MB by dividing it by 1024.0 * 1024.0 . Of course this works, but I am wondering is there a better way to do this in Python? By better, I mean perhaps a stdlib function that can manipulate sizes according to the type I want. Like if I specify MB , it automatically divides it by 1024.0 * 1024.0 . Somethign on these lines. There is hurry.filesize that will take the size in bytes and make a

smallest filesize for transparent single pixel image

我怕爱的太早我们不能终老 提交于 2019-11-28 15:44:15
问题 I'm looking for the smallest (in terms of filesize) transparent 1 pixel image. Currently I have a gif of 49 bytes which seems to be the most popular. But I remember many years ago having one which was less than 40 bytes. Could have been 32 bytes. Can anyone do better? Graphics format is no concern as long as modern web browsers can display it and respect the transparency. UPDATE : OK, I've found a 42 byte transparent single pixel gif: http://bignosebird.com/docs/h3.shtml UPDATE2 : Looks like

Find size of git repo

只愿长相守 提交于 2019-11-28 14:58:38
What's a simple way to find the size of my git repository? And I don't mean du -h on the root directory of my repo. I have a lot of ignored files so that size would be different from my total repo size. I essentially want to know how much data would be transfered upon cloning my repo. sehe UPDATE git 1.8.3 introduced a more efficient way to get a rough size: git count-objects -vH (see answer by @VonC) For different ideas of "complete size" you could use: git bundle create tmp.bundle --all du -sh tmp.bundle Close (but not exact:) git gc du -sh .git/ With the latter, you would also be counting:

How to find running application size programatically in blackberry?

感情迁移 提交于 2019-11-28 12:31:17
问题 i want to find the size of running application of blackberry by code.I checked the how to find application size in blackberry by code? link but i am not getting answer. Please suggest me solution. Thanks in advance. 回答1: If you mean of size of running application that size of total cod files then we can calculate. when we instal application using JAD we can see the application size. For example: my application name is PictureBackground After successful sign in application we can take cod fils

MySQL Convert Bytes to Kilobytes, Megabytes, Gigabytes

蹲街弑〆低调 提交于 2019-11-28 12:11:05
I have a logs table that stores various file sizes in bytes. I want to be able to query the database and return the smallest possible float which has been converted to MB GB etc. At present I can return the value in MB but how do I continue to divide further to smallest value and append the unit? SELECT CONCAT( ROUND( SUM( data_transferred ) /1048576, 2 ) , ' MB' ) FROM `logs` Any help would be appreciated. UPDATE: Based on the link voodoo417 provided I updated my query to the following, which will output the most relevant file size to two decimal places and append the unit (1000 Bytes, 1 KB,

How to prevent Warning: POST Content-Length and memory size

*爱你&永不变心* 提交于 2019-11-28 11:13:20
Currently when user uploads a photo the page says "Warning: POST Content-Length of XXX bytes exceeds the limit of 21000000 bytes in Unknown on line 0". I know what that means and I am NOT looking for the solultions like the increasing the max_upload values or even memory_size_limit... Because users may and users will upload terabytes of nonsense even if you explicitly tell them only max 20MB files and only images are allowed. I am looking for a solution on: How to prevent this warning(s) to even happen? OR at least: How to prevent displaying of this warning(s)? EDIT: PLEASE READ ! - Please

file input size issue in safari for multiple file selection

杀马特。学长 韩版系。学妹 提交于 2019-11-28 10:02:32
I am experiencing inconsistencies with regard to multiple file upload in Safari 5.1 on Windows Vista (haven't tried other platforms). The input element has the multiple flag to allow selection of multiple files. The problem occurs when the user does actually select more then one file. In this case, each File has a size attribute of 0 . If (still with the multiple flag), the user only chooses one file, the size attribute correctly contains the file size. The problem can be seen in the following example. Test and view the output of both a single file selection and a multiple file selection. (You

How to limit file size on commit?

情到浓时终转凉″ 提交于 2019-11-28 09:21:14
I'm fully aware of this question which technically makes this a duplicate but the answers only offer a solution on push , which would be too late for my requirements. Is there an option to limit the file size when committing? For example: file sizes above 500K would produce a warning. File sizes above 10M would stop the commit. This pre-commit hook will do the file size check: .git/hooks/pre-commit #!/bin/sh hard_limit=$(git config hooks.filesizehardlimit) soft_limit=$(git config hooks.filesizesoftlimit) : ${hard_limit:=10000000} : ${soft_limit:=500000} list_new_or_modified_files() { git diff

android reduce file size for camera captured image to be less than 500 kb

主宰稳场 提交于 2019-11-28 09:01:15
My requirement is to upload camera captured image to the server, but it should be less than 500 KB. In case, if it is greater than 500 KB, it needs to be reduced to the size less than 500 KB (but somewhat closer to it) For this, I am using the following code - @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { try { super.onActivityResult(requestCode, resultCode, data); if (resultCode == getActivity().RESULT_OK) { if (requestCode == REQUEST_CODE_CAMERA) { try { photo = MediaStore.Images.Media.getBitmap( ctx.getContentResolver(), capturedImageUri); String