Skip to content

Instantly share code, notes, and snippets.

Avatar
🦀

Joshua Arulsamy jarulsamy

🦀
  • University of Wyoming
  • Laramie WY
  • 12:46 (UTC -06:00)
View GitHub Profile
@jarulsamy
jarulsamy / TurnOffDisplay.cpp
Created June 6, 2023 06:36
Turn off display in windows
View TurnOffDisplay.cpp
#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!
View mimetype-fix.sh
xdg-mime default org.gnome.Nautilus.desktop inode/directory
@jarulsamy
jarulsamy / msort.c
Last active February 2, 2023 19:12
View msort.c
/* 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
View flash.sh
#!/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
#
View Cal.py
#!/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.
View powder_plot.py
"""
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
View get_gh_repos.py
#!/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
@jarulsamy
jarulsamy / backup.sh
Last active July 29, 2022 19:24
Linux backup home directory daily.
View backup.sh
#!/usr/bin/env bash
#
# Backup home directory
#
#
set -o errexit
set -o nounset
set -o pipefail
@jarulsamy
jarulsamy / RebootLinux.bat
Last active June 23, 2022 20:21
Reboot to Linux From Windows
View RebootLinux.bat
:: _Sigh_ Windows dumbness...
powershell .\RebootLinux.ps1
@jarulsamy
jarulsamy / cloudSettings
Created July 20, 2020 03:06
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2020-07-20T03:06:02.042Z","extensionVersion":"v3.4.3"}