Skip to content

Instantly share code, notes, and snippets.

View jarulsamy's full-sized avatar
🦀

Joshua Arulsamy jarulsamy

🦀
View GitHub Profile
@jarulsamy
jarulsamy / kc-sync.py
Created February 19, 2024 20:58
Syncing groups and users from IdM to Keycloak.
#!/usr/bin/env python3
"""
kc-sync - Sync existing Keycloak users group memberships with IdM.
This script:
1. Creates all groups from IdM in Keycloak
2. Queries Keycloak for all users within the realm.
3. Finds the corresponding user within IdM.
4. Calculates which groups a given user should be added to/removed from.
5. Either shows the changes to be made or performs the previously calculated transactions.
@jarulsamy
jarulsamy / FastX3.desktop
Created January 15, 2024 18:41
Installing FastX3 Client on Linux
# ~/.local/share/applications/FastX3.desktop
[Desktop Entry]
Name=FastX3
Version=1.0
Type=Application
Terminal=false
Exec=/opt/FastX3/FastX3
@jarulsamy
jarulsamy / cleanup_net.sh
Last active October 10, 2023 13:23
Cleanup Calico
#!/usr/bin/env bash
set -x
ip route flush proto bird
ip link list | grep cali | awk '{print $2}' | cut -c 1-15 | xargs -I {} ip link delete {}
rm -rf /etc/cni/net.d/
@jarulsamy
jarulsamy / TurnOffDisplay.cpp
Created June 6, 2023 06:36
Turn off display in windows
#include <iostream>
#include <windows.h>
int main()
{
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2);
return 0;
}
@jarulsamy
jarulsamy / mimetype-fix.sh
Last active March 19, 2023 21:14
Why does VS Code set itself as the default application for directories?! I may be an emacs user, but even I don't want my text editor intercepting every call to xdg-open!
xdg-mime default org.gnome.Nautilus.desktop inode/directory
@jarulsamy
jarulsamy / msort.c
Last active February 2, 2023 19:12
/* An alternative to qsort, with an identical interface.
This file is part of the GNU C Library.
Copyright (C) 1992-2023 Free Software Foundation, Inc.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
@jarulsamy
jarulsamy / flash.sh
Created January 19, 2023 00:00
Instructions for flashing the Nvidia Jetson Xavier AGX
#!/usr/bin/env bash
#
# Flashing the Nvidia Jetson Xavier NGX
# Good luck, Nvidia - as usual - did not make this easy for anyone.
# (this is a massive pain on non-ubuntu hosts).
#
# 1. Install these packages
#
# $ sudo pacman -S qemu-user-static qemu-user-binfmt
#
#!/usr/bin/env python3
"""
Convert malformed calendar entries into Org-Agenda TODO items.
Usage:
1. Export Canvas calendar to Google Calendar.
2. Export Google Calendar to ICS.
3. Load ICS into Emacs iCal.
4. Pipe contents of Emacs iCal schedule into this script. (cat school_schedule.org | ./cal.py > physics.org)
5. Profit?
@jarulsamy
jarulsamy / powder_plot.py
Created November 23, 2022 20:48
Plot powder diffraction data directly to an Excel document.
"""
MIT License
Copyright (c) 2022 Joshua Arulsamy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
#!/usr/bin/env python3
"""Get all the Github repositories for the currently authenticated gh-cli user."""
import json
import os
import subprocess
from pathlib import Path
from typing import Union
import requests