Skip to content

Instantly share code, notes, and snippets.

@binki
binki / post-file.js
Last active October 4, 2023 14:35
posting a file loaded through fs.readFile() through axios+form-data
#!/usr/bin/env node
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
const filePath = __dirname + '/../accept-http-post-file/cookie.jpg';
fs.readFile(filePath, (err, imageData) => {
if (err) {
throw err;
}
#!perl
my $lol = bless { string => "test_string" };
$lol->{cycle}{reference}[0] = $lol;
my $lol1 = bless [];
$lol1->[0]{yet}{another}{cycle}{reference} = $lol1;
use strict;
require Devel::Gladiator;
@hateradio
hateradio / html64.rb
Last active April 29, 2024 05:58
ruby image to base64 string
require 'base64'
# converts attached PNGs into base64 strings
# Eg
# <img src="my.png" /> to <img src="data:image/png;base64,..." />
class To64Html
def initialize(path)