Skip to content

Instantly share code, notes, and snippets.

View jay's full-sized avatar
🇺🇸

Jay Satiro jay

🇺🇸
  • New Rochelle, New York, United States
View GitHub Profile
@jay
jay / PostUpload.c
Last active October 25, 2022 21:40
Use libcurl to upload POST data.
/* Use libcurl to upload POST data.
Usage: PostUpload <post_data_filename> <url>
Used this as a speed test in Win7 x64, see
https://github.com/curl/curl/issues/708
First test the speed in a web browser:
Go to https://testmy.net/mirror and choose the geographically closest mirror.
After the mirror is set click on 'Upload Test'.
@jay
jay / PostJSON.c
Last active July 31, 2022 20:35
Use libcurl to POST JSON data.
/* Use libcurl to POST JSON data.
Usage: PostJSON <name> <value>
curl-library mailing list thread:
'how do i post json to a https ?'
https://curl.haxx.se/mail/lib-2015-01/0049.html
* Copyright (C) 2015 Jay Satiro <raysatiro@yahoo.com>
https://curl.haxx.se/docs/copyright.html
@jay
jay / multi_vs_easy.cpp
Last active October 31, 2021 05:09
Use libcurl to test multi vs easy performance.
/* Use libcurl to test multi vs easy performance.
Usage: multi_vs_easy
This program compares the different methods that can be used to make transfers
to the same host. The code was written only for the purpose of comparison of
the different methods.
g++ -o multi_vs_easy multi_vs_easy.cpp `curl-config --cflags --libs`
@jay
jay / ShowGmailFolders.c
Last active October 18, 2021 20:44
Use libcurl to retrieve Gmail folders and labels via IMAP over SSL (IMAPS).
/* Use libcurl to retrieve Gmail folders and labels via IMAP over SSL (IMAPS).
Usage: ShowGmailFolders <username> <password>
curl-library mailing list thread:
'Re: DL curl 7.35 mingw32'
http://curl.haxx.se/mail/lib-2015-05/0037.html
Note: When you attempt to login to Gmail via IMAP they sometimes require a
web login first for security reasons. In that case an error will be shown. Such
@jay
jay / change_openssl_lib_names.pl
Last active March 1, 2021 08:31
Update curl project file templates for OpenSSL 1.1.x
#!/usr/bin/env perl
=begin comment
README
./change_openssl_lib_names.pl
This script was written to update Windows project file templates in the curl
repo. It changes the OpenSSL libnames from 1.0.x to 1.1.x:
@jay
jay / multi_synchronous.cpp
Last active February 10, 2021 22:54
Use libcurl to test synchronous transfers in a multi.
/* Use libcurl to test synchronous transfers in a multi.
Usage: multi_synchronous
This is a demonstration of a repeated synchronous transfer done in a multi
by creating a separate easy handle for each transfer. Normally you would not
do this, you'd use curl_easy_perform in a loop instead.
I forget what curl issue I wrote this in response to.
@jay
jay / getargs.c
Last active January 19, 2021 07:54
Display how arguments are parsed in Windows
/*
Display how arguments are parsed in Windows.
VS 2010 x86:
cl /nologo /W4 getargs.c /MD /Fegetargs-cl && getargs-cl
VS 2010 x86, for win2k compatibility build against the WinDDK:
cl /nologo /W4 getargs.c /MD /Fegetargs-cl C:\WinDDK\7600.16385.1\lib\win7\i386\msvcrt_win2000.obj /IC:\WinDDK\7600.16385.1\inc\crt /link /SUBSYSTEM:CONSOLE,5.00 /OSVERSION:5.00 /LIBPATH:C:\WinDDK\7600.16385.1\lib\Crt\i386 && getargs-cl
mingw x86:
@jay
jay / utf8_encoded_example.bat
Last active January 17, 2021 07:04
Example of a UTF-8 encoded batch file.
:: Example of a UTF-8 encoded batch file.
::
:: Usage: utf8_encoded_example.bat
::
:: Ref: https://github.com/curl/curl/issues/6386#issuecomment-761745450
::
:: Public Domain: No License. Written by Jay Satiro <raysatiro@yahoo.com>
::
:: https://gist.github.com/jay/731030525b58ae3845b7ba59c0757b3c
::
@jay
jay / add_crypt32.pl
Last active June 4, 2020 07:33
Add crypt32.lib to AdditionalDependencies in curl project templates
#!/usr/bin/env perl
=begin comment
README
./add-crypt32.pl
This script was written to fix Windows project file templates in the curl repo.
It adds crypt32.lib to any additional dependency list that contains
ssleay32.lib (OpenSSL), if it is not there already. crypt32 is now usually
@jay
jay / CurrentSpeed.c
Last active February 20, 2020 22:37
Use libcurl to show the current speed while transferring a file.
/* Use libcurl to show the current speed while transferring a file.
Usage: CurrentSpeed
This example downloads a 200MB file from a speedtest server and shows the
current speed during the download. The current speed is updated approximately
once every second based on the last 5 seconds. The file is not saved to disk.
The bulk of the code in this example came from libcurl's lib/progress.c.
https://github.com/curl/curl/blob/curl-7_68_0/lib/progress.c