Skip to content

Instantly share code, notes, and snippets.

@warrenkc
warrenkc / convert-celcius-to-fahrenheit.ps1
Last active April 2, 2023 01:01
Convert Celcius to Fahrenheit: Powershell Script
# Load WPF assemblies
Add-Type -AssemblyName PresentationFramework
# Define XAML code for the GUI
[xml]$xaml = @"
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Celsius to Fahrenheit Converter" Height="250" Width="400">
<Grid>
<Label Content="Celsius:" HorizontalAlignment="Center" Margin="0,40,0,0" VerticalAlignment="Top" FontSize="16" FontWeight="SemiBold"/>
@warrenkc
warrenkc / SquareTokenTest.js
Created November 15, 2022 03:04
SquareTokenTest.js
const appId = 'sq0idp-yCB3jRpR0PbPfffcFBEVbA';
const locationId = 'LGB4QKD1ME9BE';
const username = 'xxxx';
const amount = '500';
const partyId = 'xx';
const winningBidderId = 'xxxx';
const auctionGroupId = 'xxxx';
async function initializeCard(payments) {
const card = await payments.card();
@warrenkc
warrenkc / square-create-payment-link.py
Created October 28, 2022 06:31
Create payment link for Square in Python
@warrenkc
warrenkc / fix-wol-bible reading.js
Last active November 29, 2022 01:47
Fix bible reading from https://wol.jw.org/id for text to speech in Indonesian
// For https://wol.jw.org/ms Bible reading in Edge browser using text to speech. This will allow the browser to read the text without the verse numbers being read.
// Add chapter to chapter number
var elements = document.querySelectorAll('.cl');
element = elements[0]
var chapterNumber = element.innerText.trim()
element.innerText = `Pasal ${chapterNumber}: `
// Turn off reference symbols.
elements = document.querySelectorAll('.toggle');
var uppy = new Uppy.Core({
autoProceed: true,
restrictions: {
allowedFileTypes: ['image/*']
},
onBeforeFileAdded: (currentFile, files) => {
// Change the file name to the last modified date. This file name doesn't arrive at the server upload handler.
const modifiedFile = {
...currentFile,
name: currentFile.data.lastModified + ".jpg"
@warrenkc
warrenkc / uptime.cs
Created June 24, 2022 09:33
Sample C# code for Uptime Robot Heartbeat Monitor
var client = new HttpClient();
// Heartbeat URL
const string url = "https://heartbeat.uptimerobot.com/YOUR CODE HERE";
// Get the response.
HttpResponseMessage response = await client.GetAsync(url);
Console.WriteLine(response.StatusCode);