Skip to content
View Hicsy's full-sized avatar

Block or report Hicsy

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
Hicsy/README.md

About

Hi there 👋

My public repos are mostly tutorials, the occasional hobby, and experiments for work tomorrow.
Below are examples of my coding-style in a couple languages.
They might just be a relevant snippet that has been stripped from my bitbucket and anonymised.

Terms used

[Expand Section: Terminology definitions]
  • Controller/controlscript: A separate function often used with pre-defined variables to operate one or more tools such as a batch-file or a GUI. eg SendWeeklySmsEmail.bat managers.csv
  • PR: A Pull-Request in Git.
  • Tool/toolscript: Generally a module or "black-box" function which probably has some common parameters and will push one output. eg get-smsReport

Preferred Styleguides / Conventions:

[Expand Section: Links for StyleGuides used with each language]

I will try to stick to these style-guides where I can:



Examples

Contribution example: VS-Code Plugin 🧩

📜[show details + PR link]
  • Language: JSON / Regex
  • Description: Add ;region code-folding support to .ahk files in VS-Code.

Link

cweijan/autohotkey-plus#43

About

💬[Show/Hide overview]

Visual Studio Code is a nifty all-in-one editor/debugger for AutoHotKey, but the language hasn't defined cold-folding regions like other languages such as C# (#region/#endregion), or JavaScript (//#region///#endregion).

I found a good active plugin with syntax-highlighting for AutoHotKey's .ahk files, and got to work with a proposal to implement folding:

  1. I double-checked folding conventions for other languages.
  2. Learned how VS-Code Language-Extenstension features are defined with examples.
  3. Checked my usual Regex resources and examples for guidance.
  4. Tested my concept locally in VS Code.
  5. Started discussions for the Enhancement Request in GitHub.
  6. Created a Pull-Request with my code using GitHub's new propose a change feature.

Goals

  • Implement Code-Folding regions for .ahk scripts in VS-Code.
  • Support various whitespace arrangements.
  • Allow for H1/H2 rules on the same comment line for current AHK users.

Outcomes

  • ➕ PR was accepted and implemented.
  • ➕ Successfully added .ahk code-folding to my VS-Code by myself.
  • ➕ Got some great practice with the new way to do quick PR's in GitHub.
  • ➕ Learned a lot about .NET's RegEx and then created some awesome new automated code snippets using my new skills.

PowerShell tool/controller example 🛠

📜[show details + repo link]
  • Language: PowerShell
  • Description: Uses the old Azure module to scrape from the Office 365 Graph.

Link

https://github.com/Hicsy/AzureV1Report

About

💬[Show/Hide overview]

The function was written as a work-around for a client with O365 which we didn't have administrator access to. Before this little tool: it was considered normal to bounce a ticket to vendor (3-day turnaround) just to get a login-name, or to diagnose why a caller's Skype was no longer connecting. I (ab)used the old V1 Microsoft Graph API module to scrape the client's full graph for login names, SIP, aliases, staff id, and licenses... then cobble in some less ambiguous product names, and spit out a tab-delimited .csv file.

This is a stripped out example of tool-code that was actually used in production quite frequently. It was hacky and quick, and only a POC which unfortunately never got approved for development... so instead, I slapped some control-code within; at-least my colleagues could also use what we had on-the-fly. Time savings from this script alone gained me about 5-10 hours per week, with ~5 other techs using it daily, we'd consistently save 20+ hours weekly using this simple script.

With more time I would have liked to:

  • Add some nice dedicated controller scripts and keep the module pure.
  • Create module manifests and tests.
  • Update to support PowerShell core / v7.
  • Code in a fallback to the real productNames (for any license names I hadn't overridden).
  • Break those advanced-properties into a second step so the lookups (licences, aliases etc) don't holdup the core loop. 3x lookups on 200k users not using parallel pipelines becomes slooow...

Goals

  • Build user-reports on an O365 tenant without using an administrator account.
  • Support single-user lookups and wildcards on various fields.
  • Output can be sent to my other tools later; Converted to a single-use mode control-script instead.

Outcomes

  • ➖ Concept not approved by management for further development.
  • ➖ Use-case changed from a pure "tool" to a controller for junior staff.
  • ➕ Widely adopted by my coworkers. Saves 10-20hrs labour per week.
  • ➖ Single-Use was scrapped as out-of-scope. Techs just manually lookup users in the CSV instead to save MFA+2FA hoop-jumping time.

Python REST server (bottle) example 🧪

📜[show details + repo link]
  • Language: Python / BottlePy
  • Description: A quick REST listener I used for testing my APIs

About

💬[Show/Hide overview]

This Python 3 RESTful* server is what I used as a simple queue service while I was testing my game server mod. The videogame only supported HTTP GET and POST (rather than PUT/PATCH) so it would respond appropriately to those requests.

I programmed some buttons on my StreamDeck device to send requests to this API and tested it live with about 8 friends. Later I added some "quick command" endpoints which my friends could trigger (while I was away) by simply refreshing pre-defined webpages.
This is why the app went from being a pure REST server, to just RESTful functions.

The front-end was beyond the scope of this example hence choosing Bottle as the lightest, fastest option for prototype testing. I would consider Django (with authentication, templates, and a persistent database) to support a production front-end.

Link

https://github.com/Hicsy/DST-Rest-Prototype

Goals

  • Playing with REST API's in Python.
  • Take some 'command' in JSON, queue it at the right REST endpoint, update its status once retrieved.
  • Quick testing with POSTMAN + StreamDeck buttons to quickly simulate/test inbound commands.
  • Just a prototype, so no Auth/Database/WebPage

Outcomes

  • Practised Google's Python stylesheet, and basic BottlePy (Bottle/Flask templates = beyond scope / not practised).
  • Completed testing of my game mods using this tool.
  • Added a couple basic HTTP-GET endpoints for friends to test via web (non-RESTful).

NodeJS Screeps bot 🤖

📜[show details + Repo URL]
  • Language: Javascript (functional Node.js)
  • Description: My bot I use in online Screeps battles

About

💬[show/hide overview]

Screeps is an online game where you battle your army of bots on (what they call) a real-time strategy battlefield. It's really turn-based gameplay: Every second-or-so it will run all your JavaScripts top-to-bottom, serialise it, execute on the C++ game server, and then deserialise the whole game-state as a JSON string to run from scratch again next tick.
As such, I don't think callbacks etc would have any real use to a simple bot. I fluffed-out the Screeps tutorial by breaking it out into more modular functions... functional is definitely the key-word here.

Once I get my head around game ai StateGraphs I am interested to rebuild this as an object-based bot and then compare performance.

Link

https://github.com/Hicsy/Screeps

Goals

  • Learn google's .js formatting styleguide.
  • Practice basics like arrow functions and Lodash filters.
  • Start using GitHub for more than just an "origin backup".
  • (stretch) Implement testing and make a deployment workflow.

Outcomes

  • This one is still a work in progress.
  • Got to learn Javascript formatting, but not normal nodeJS programming.
  • I have started to learn about deployment workflows.
  • Started practising GitHub partial sync and additional remotes.

LUA game mod example 🎮

📜[show details + Repo Link]
  • Language: LUA
  • Description: A remote-control mod I wrote for Don't Starve Together.

About

💬[show/hide overview]

The videogame Don't Starve Together is hardly documented but the game itself is just a little binary that runs LUA scripts out of a .zip file... So I had a look through them and thought this would be a chance to refresh my LUA.
I like the idea of external sites, devices, sensors, and services being able to send commands to the gameserver but I couldn't work out how to open a socket connection so I thought a mod that polls a queue would be a fun addon...

Link

https://github.com/Hicsy/DST-MOD-REST-API

Goals

  • Practice my LUA.
  • Learn the Don't Starve Together environment.
  • Mod my gameservers to accept external command inputs.

Outcomes

  • Needs API-key support added, otherwise done.

AutoHotkey Script ⌨

📜[show details + Repo Link]
  • Language: AutoHotkey
  • Description: An example of an AutoHotKey to control a program as user.

About

💬[show/hide overview]

My fascination for automation got me thinking about general workflow shortcuts and GUIs which we have less control over. I have seen AutoHotKey thrown around before and found a good opportunity to give it a whirl.

If I didn't quite catch something while watching YouTube on another monitor, I can't just use my media buttons to jump back 10 seconds to repeat that last bit. Instead I break my focus, click on the YouTube screen (which also pauses it), tap j to scrub back, resume... and finally go back to what I was doing.
After looking into ways to send FF/REW from my StreamDeck or remapping my keyboard's media keys, I found issues with the way background apps (Spotify, MediaPlayer...) occasionally take focus of those commands over Chrome+YouTube.

If I wanted to control YouTube directly, Chrome has to be launched in developer mode - which limits the possibility of ad-hoc use. Not-to-mention that I use multiple browsers at any one time.

An easy solution right in front of me was to write an AutoHotKey which hooks on the media keys, and sends the commands directly to the last known YouTube window...

Link

https://github.com/Hicsy/AHK-YouTube

Goals

  • Learn AutoHotKey.
  • Control YouTube without losing application focus (and mental focus).
  • Aim for ad-hoc usage (rather than having to pre-empt opening a video in a particular app/player, etc)

Outcomes

 ➕ Using AutoHotKey 1 examples, I built this in AHK2, effectively learning both languages.
 ➕ Successfully works across any browser and handles moving tabs to new windows etc.
 ➕ I also got more comfortable with heavily-customising my Visual Studio Code.


Pinned Loading

  1. AHK-YouTube AHK-YouTube Public

    AutoHotKey v2 script to control YouTube playback without stealing focus

    AutoHotkey 5

  2. AzureV1Report AzureV1Report Public

    A hacky Azure V1 module used to scrape O365 user info.

    PowerShell

  3. DST-MOD-REST-API DST-MOD-REST-API Public

    A basic REST API mod for Don't Starve which pings a command queue server for a new command and executes it.

    Lua 1

  4. DST-Rest-Prototype DST-Rest-Prototype Public

    A quick BottlePy host for REST API testing

    Python

  5. Screeps Screeps Public

    JavaScript

  6. cweijan/autohotkey-plus cweijan/autohotkey-plus Public archive

    AutoHotkey language support for Visual Studio Code

    TypeScript 132 18