How to check HTTP Header and Connection Stats from the Command Line

A few days ago, I discussed with somebody whether a file was cached by Cloudflare or not, and this involved getting the HTTP header, and checking for CF-RAY field to see if data is going through one of Cloudflare data centers. This can be done with curl: In the command above, -s stands for silent so that curl does not show the progress meter, -v stands for verbose to show the header, and -o /dev/null is used to discard the packet load. You can also use -I option (fetch the HTTP-header only) with curl, which – if all you need is the HTTP header – provides a cleaner output: I also came across httpstat Python script recently via n0where, doing much of the same thing, except it also adds transfer statistics. It can be installed by downloading httpstat.py, or better using pip: Let’s try it with this very blog: The header is the same as with Curl -I, and for good …

Borg Lets You Search for Bash Commands within the Terminal

There are so many commands available in bash that it’s impossible to know them all, and some commands are rarely run. Usually, you have to switch to your web browser to search for a solution or spending time reading through the manpage. In case you’d like to search for a specific command line you can now do so with borg script. If you want to give it a try, you can install it in Linux as follows: Then run the script with your search query in quotes. Some explanations for the output: () denotes hits for your query [] denotes possible solutions … under a [] means more lines to display a “–” in a solution means separate code examples extracted from the same source Some queries are returning useful results such as “list all files in dir” as show in the screenshot above, but others not so, as least for now: This may improve in the future, as “adding …

Create-android-sdcard Script Creates a Bootable SD Card for any Rockchip RK3188 Devices

Bootable Linux SD card images for some Rockchip RK3188 devices such as MINIX NEO X7, MK809III, Tronsmart T428 have already been released this summer, and it provided any easy way to try Linux on Rockchip RK3188 devices without messing with your Android installation. But now you can create Android bootable images with any Rockchip RK3188 devices thanks to create-android-sdcard script written by Ian Morrison, as long as you have the firmware for your Android mini PC, and I don’t see why it would not even work for tablets. It allows you to try Android firmwwre before replacing your existing installation (great for developers), and it can also be a way to handle multiple users on a single device. There could be one SD card for dad, one for mum, and one for the kid, and all you have to do is to take out and replace the SD card with your own each time you want to use the device. …

How to Upload YouTube Videos with the Command Line in Linux

Like many people, I access Internet via an ADSL connection at home. ADSL stands for “Asymmetric Digital Subscriber Line”, with Asymmetric being the key word here, as it just mean your download speed will be (much) higher than your upload speed. My ISP promises a theoretical 10 Mbps download speed, and 512 Kbps upload speed, and this is pretty close in reality: Data Rate: 10240 (downstream), 509 (upstream) kbps. Assuming a 265MB video, in the very best case (63 KB/s), it would take 1 hour and 12 minutes to upload a video to YouTube, but in practice it’s often closer to 2 or 3 hours. If it’s a video you’ve shot yourself, and copied inside your computer, there’s very little you can do, except processing the video with tools such as HandBrake to make it smaller before upload. But if the video files are located somewhere in the Internet, and you happen to have access to a VPS or dedicated …

You-Get – Video Download Script for YouTube, YouKu, DailyMotion, and More

YouKu is the equivalent of YouTube in China, and earlier today I wanted to download a video from the service, so I’ve looked for an application or script that can do the job in Linux. I’ve finally come across you-get, a python 3 script that claims to be able to download videos from an impressive number of websites, namely: YouTube Vimeo Coursera Blip Dailymotion Facebook Google+ Google Drive Tumblr Vine SoundCloud Mixcloud Freesound JPopsuki VID48 Niconico (ニコニコ動画) Youku (优酷) Tudou (土豆) YinYueTai (音悦台) AcFun bilibili CNTV (中国网络电视台) Douban (豆瓣) ifeng (凤凰视频) iQIYI (爱奇艺) Joy.cn (激动网) Ku6 (酷6网) MioMio h NetEase (网易视频) (v.163.com) PPTV.com QQ (腾讯视频) (v.qq.com) Sina (新浪视频) (video.sina.com.cn) Sohu (搜狐视频) (tv.sohu.com) 56 (56网) Xiami (虾米) Baidu (百度音乐) (music.baidu.com) SongTaste I won’t try all, but just test it with YouKu and YouTube. First things first, let’s install it: Time to go to youku.com and download a video: Success! And now Youtube: All good, and that was easy. To download several …

How to Display dd Progress and dd.sh Script

Upgrading software on Linux / Android boards or devices often involves copying images to an SD card or microSD. In Linux, you’d usually do that with dd, a utility that provides binary copy of data to files or block devices. A typical command would be: However, during the copy, dd does not show a progress bar by default. But dd actually supports progress report, as indicated in the manpage: you can run dd, and send USR1 signal to display the current progress once, and resume copying. Linux commando explains how to continuously return the progress. First run the dd command: Open another terminal window to find out the process id: And use the watch command to send USR1 at regular interval. You should see dd progress in the first window every 10 seconds. It works, but the output is not very nice because dd will just output 3 lines at a time, and you’ll see something like: I’ve recently come …

makeSD Script to Write Image to SD Card for Mele A1000 / AllWinner A10 Devices

Most images released for Mele A1000 (Ubuntu, Puppy Linux..) won’t fit in my SD card, and until now I had to manually partition the SD card, extract the data and copy it to the SD card. I’ve also noticed the size of the SD card slowly creeps lower overtime. I bought an SD card last week and fdisk reported 3901685760 bytes and this morning the same command reported 3898782720 bytes. That’s probably due to new bad sectors which I believe is actually normal for this type of device. The problem is that a backup of “last week” SD card done with dd might not be restored properly with dd since the SD card is now smaller. So I decided to write a shell script “makeSD.sh” that will do the following: Umount the SD card if needed Partition the SD card Copy uboot to the SD card Mount the image file and SD card partitions Copy the files between the image …