Showing posts with label github. Show all posts
Showing posts with label github. Show all posts

11 June 2025

Kotlin script running on GitHub Actions

I wanted to run a script regularly and didn't really want to run it on my local machine each time. So it turns out you can run scripts regularly on GitHub Actions. What's even better is its super simple to setup. Of course there are some limits to how many minutes you can run per GitHub's billing page. Currently this is 2000 minutes.

First I created a fresh repository with one single file in it. I named that file Test.main.kts and added the following contents:

val helloName = "Bob"

println("Hello $helloName from the kotlin script")

I commit that to my repo and then create a GitHub Action, this can be named whatever you want, mine is named main.yml here are the contents:

name: Just a test

# configure manual trigger
on:
  workflow_dispatch:

jobs:
  just-a-test:
    name: Run a Kotlin script 
    runs-on: ubuntu-latest
    timeout-minutes: 5
    steps:
      - uses: actions/checkout@v2
      - name: Run Kotlin script
        run: kotlinc -script ./Test.main.kts

This checks out your repo onto a ubuntu runner and runs your script. Super simple and this will run whenever you manually execute it using the web control in GitHub. Of course you can schedule this if needed.

The slight complication comes when you want imports, this is where you need to balance local setup and GitHub with scripts. I have been using IntelliJ and INtelliJ with scripts don't seem to play super well yet, maybe I'm missing something. You can add imports into the script file using @file:DependsOn() but how you get this into your project locally is still a bit confusing to me. It might be that IntelliJ doesn't really support this lightweight type of script based project yet.

05 April 2022

Git on Windows with Putty

This is something that's super simple on Linux but every couple of years I have to setup a new Windows machine with GIT and Putty (pageant to be exact). Every time I do it I seem to forget one of the steps and spend a few hours trying to remember what I've missed. So here is the note to myself so I can remember how to do it.

Components to install:

  1. Putty including of course puttygen and pageant

  2. Git Bash


1) Generate a ssh key 

I won’t go into details here as there are a million tutorials already on the internet but you want to use Puttygen to create a new private/public security key pair. You can save this as a .ppk file on your local machine.


2) Upload the public key to GitLab / Github

Copy the public key from inside Puttygen to GitLab or GitHub. You'll need to find the page on your account where you can add an SSH key and paste it in there. Be sure this is the public key and not the private one.


3) Run pageant 

Run pageant and it should appear in your system tray. Now open it and add the .ppk to your keys.


4) Add a GIT_SSH environment variable

Using this for advice:

https://stackoverflow.com/a/43313491

Create an environment variable that points to plink. This is probably the step I forget the most.

5) Configure GIT

You now need to ensure you have the correct url added to your git repo. A few times I've used the http one or the wrong url or something. Carefully copy the SSH (git@gitlab.com...) url from Gitlab or Github and add this to your git project as a remote repo url. You can check you've done this correctly by typing git remote -v


That's it. You should definitely restart Git bash and restarting your PC wouldn't hurt either, just make sure you start up pageant again. Another thing I forget is how to get this to run on startup. Oh it's a complicated life!

11 January 2014

The death of noisypix.com

Some time ago I noticed every one of my (technologically challenged) parent's photos were taken at around eight million gigabytes. Backing them up was becoming a pain and taking up a huge amount of space! So I created noisypix, a simple website to upload photos and images too and be provided in return with a smaller shrunk down file which was more reasonable to maintain.

The core of the project was Coldfusion and I already knew photo manipulation was quite simple using
<cfimage>
The exciting part of the project for me was going to be some HTML 5 goodness tucked in with some bootstrap, jquery and jquery filedrop.

Sadly time has passed and I've moved on to other things. Noisypix sits on a linux box with a copy of railo making it all tick. The problem being it costs me money! Not a huge amount but some, and I'm trying to cut back. Plus by the looks of Google Analytics, hardly anyone uses it!

So I've come to the painful decision to kill my linux box and let noisypix out into the wild. I'm going to open source it, post it on github and see what the world does with it. I doubt much will happen but I hope someone one day will learn something from it.

So sometime in February I'll be pulling the plug. If you'd like to check out my code and see what you think, or perhaps even improve and host it yourself, you're most welcome too.

https://github.com/jimbo1299/noisypix