Skip to content

Instantly share code, notes, and snippets.

View larsschenk's full-sized avatar
💭
Working on ActiveBarcode

Lars Schenk larsschenk

💭
Working on ActiveBarcode
View GitHub Profile
@larsschenk
larsschenk / ec2-delete-registered-snapshot
Created August 21, 2021 11:49
Legacy code from Oct 5 2012. Deleting registered ec2 snapshots by first unregistering the ami and then deleting the snapshot.
#!/usr/bin/env ruby -W0
# -W0 = disable Ruby “Insecure world writable dir” warnings
# ec2-delete-registered-snapshot
#
# This is a simple timesaver script for deleting registered snapshots by
# first unregistering the ami and then deleting the snapshot.
# I use it for the EBS based backups that I create by another script.
#
# The ec2-descripe-snapshots output is as follows:
@larsschenk
larsschenk / word-barcodes-on-each-page-with-variable-content-and-page-numbers.vba
Last active March 26, 2020 15:58
Word Macro (VBA) to add one barcode to each page containing a variable content and a page number.
Option Explicit
' Konzept - Barcode beim Öffnen eines Dokumentes hinzufügen.
'
' Ein oder mehrere Barcodes werden beim Öffnen eines Dokumentes bzw. beim Aufrufen von
' AddBarcodes unter bestimmten Bedinungen eingefügt.
' Auf jeder Seite wird unten rechtes jeweils ein Barcode eingefügt.
' Barcodes werden nicht als InlineShape eingefügt sondern als ein freei fließenes Shape.
' Damit wird die Positionierung des Barcodes flexibel ermöglicht.
' Als InlineShape kann der Barcode nicht frei im Dokument positioniert werden sondern muss
' sich Inline im Text befinden.
@larsschenk
larsschenk / API-call-obfuscate-key.php
Last active January 27, 2020 00:57
ActiveBarcode API call with server side script like php to obfuscate the API key.
<?php // Hide the API key and the url to the API and serve the image directly
$png = file_get_contents('https://api.activebarcode.net/v1/png?code=CODE128&text=ActiveBarcode&access=YOUR-KEY-HERE');
echo '<img src="data:image/png;base64,'. base64_encode($png) .'" />';
@larsschenk
larsschenk / Demo-ActiveBarcode-REST-API-Google-Sheets.gs
Last active January 21, 2020 03:19
Google Sheets users can add dynamic barcodes via the ActiveBarcode REST API into tables.
=image(CONCAT("https://api.activebarcode.net/v1/png?code=CODE128&access=YOUR-KEY-HERE&text=",ENCODEURL(A1)))
@larsschenk
larsschenk / ActiveBarcodeREST-API.sh
Last active January 17, 2020 20:01
ActiveBarcode REST API call with wget
wget --output-document=code128.jpg --quiet \
"https://api.activebarcode.net/v1/png?text=Hello%20World%21&typeno=14&width=500&height=100&access=YOUR-KEY-HERE"
#
# Or use simply use the ActiveBarcodeCLI
# as found @ https://github.com/larsschenk/ActiveBarcodeCLI
# Install with
# brew install schenk/barcode/activebarcodecli
#
ActiveBarcodeCLI --text='Hello World!' --type=14 --width=500 --height=100 code128.jpg
@larsschenk
larsschenk / ActiveBarcodeREST-API-with-Delphi.pas
Created December 31, 2019 16:05
Delphi examples using the ActiveBarcode REST API
// On a form (Form1) there are an input field (Edit1),
// an image (Image1) and a button (Button1).
// If you click on the button, a barcode with the text of the input field
// is retrieved via Barcode API and drawn into the image.
//
// For the retrieval the TIdHTTP (Indy Clients) component is used
// (included with Delphi 10.x).
// This component can be integrated by simply placing it on the form.
// Please note that for the https call the OpenSSL DLLs
// 'libeay32.dll' and 'ssleay32.dll' are required, e.g. in the program folder.
@larsschenk
larsschenk / ActiveBarcodeREST-API.cs
Last active December 31, 2019 15:58
Visual C# examples using the ActiveBarcode REST API
// On a form are an input field (Textbox1),
// a Picturebox (Picturebox1) and a button (Button1).
//
// If you click the button, a barcode with the text of the input field
// is called up via barcode API and drawn into the picturebox.
//
private void button1_Click(object sender, EventArgs e)
{
string ReqUrl = "https://api.activebarcode.net/v1/png?access=YOUR-KEY-HERE&";
var ReqParam = "code =CODE128&width=" + System.Convert.ToString(pictureBox1.Width)
@larsschenk
larsschenk / ActiveBarcodeREST-API-with-Word.VB
Last active December 31, 2019 15:45
Visual Basic for Application examples using the ActiveBarcode REST API with Word
' A button (CommandButton1), an image (Image1) and a form field (Text1) are in a document.
' If you click on the button, the value from the form field is displayed as a barcode in the image. (*)
' Since LoadPicture cannot use PNG, JPG is used here.
'
' (*) this can also be automated.
'
Private Declare Function URLDownloadToFile Lib "urlmon" _
Alias "URLDownloadToFileA" _
(ByVal pCaller As Long, _
ByVal szURL As String, _
@larsschenk
larsschenk / ActiveBarcodeREST-API-with-Excel.VB
Last active December 31, 2019 15:41
Visual Basic for Application examples using the ActiveBarcode REST API with Excel
' There is one Button (CommandButton1) and one Image (Image1) in the sheet.
' If you click on the button, the value of the active cell is displayed as barcode in the image.
' Since LoadPicture cannot use PNG, JPG is used here.
'
Private Declare Function URLDownloadToFile Lib "urlmon" _
Alias "URLDownloadToFileA" _
(ByVal pCaller As Long, _
ByVal szURL As String, _
ByVal szFileName As String, _
ByVal dwReserved As Long, _
@larsschenk
larsschenk / ActiveBarcodeREST-API.VB
Last active December 31, 2019 15:13
Visual Basic examples using the ActiveBarcode REST API
' On a form are an input field (Textbox1), a Picturebox (Picturebox1) and a button (Button1).
' If you click the button, a barcode with the text of the input field
' is called up via barcode API and drawn into the picturebox.
'
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim ReqUrl As String = "https://api.activebarcode.net/v1/png?access=YOUR-KEY-HERE&"
Dim ReqParam = "code =CODE128&width=" + CStr(PictureBox1.Width) _
+ "&height=" + CStr(PictureBox1.Height) _
+ "&text=" + TextBox1.Text