Skip to content

Instantly share code, notes, and snippets.

View ravage's full-sized avatar

Rui Miguel ravage

  • Portugal
  • 03:14 (UTC +01:00)
View GitHub Profile
@ravage
ravage / solidity.vim
Created February 23, 2023 17:35
Neomake Maker for solhint
function! neomake#makers#ft#solidity#solhint() abort
return {
\ 'args': ['-f', 'unix'],
\ 'errorformat':
\ '%f:%l:%c: %m %s',
\ }
endfunction
@ravage
ravage / get_cert_expire_info.rb
Created June 5, 2022 09:10
Fetch expiry date and other info from certificate
#!/usr/bin/env ruby
# frozen_string_literal: true
require "time"
require "openssl"
def get_expiry_date(host)
ctx = OpenSSL::SSL::SSLContext.new
sock = TCPSocket.new(host, 443)
{
"RNCA_report_type": "RNCA_Resource_status",
"RNCA_resource_id": "...",
"RNCA_resource_name": "...",
"report_version": "1",
"report_date": "2021-04-09 10:47:00",
"detail": [
{
"element_type": "(compute node, storage node, ...)",
"element_id": "...com significado local",
{
"RNCA_report_type": "RNCA_Resource_Usage",
"report_version": "1",
"report_date": "2021-04-09 10:47:00",
"RNCA_resource_id": "...",
"RNCA_proj_ID": "...",
"proj_resource_type": "string (HPC | CLOUD | OTHER)",
"items": [
{
"job_id": "uint",
@ravage
ravage / job_submit.lua
Last active December 27, 2020 22:57
Slurm Job Submission Policies
function slurm_job_submit(job_desc, part_list, submit_uid)
if job_desc.account == nil then
slurm.log_error("User %s did not specify an account.", job_desc.user_id)
slurm.log_user("Please speficy an account with every job submission.")
slurm.log_user("Check available accounts with: 'sacctmgr -P show assoc user=$USER format=account'.")
slurm.log_user("Specify the account with the flags -A or --account.")
return slurm.ESLURM_INVALID_ACCOUNT
elseif string.match(job_desc.work_dir, "^/home/*") then
slurm.log_error("User %s had workdir set to home directory.", job_desc.user_id)
slurm.log_user("Please don't run jobs from your home directory.")
@ravage
ravage / singleton.cs
Last active September 25, 2020 09:35
// Not thread safe
// https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/sealed
public sealed class Singleton {
// https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/static
private static Singleton instance = null;
// hide constructor from public interface
private Singleton() {}
public static Singleton Instance {
@ravage
ravage / recover_netboot.sh
Created May 14, 2020 21:51
Hopefully set previous boot order after unattended PXE installation
#!/bin/sh
test -d /sys/firmware/efi && efibootmgr -o $(efibootmgr | grep "BootOrder" | sed -e 's/BootOrder\: 0000,\(.*\)/\1,0000/')
@ravage
ravage / asuswrt-merlin-cloudflare-ddns-update.md
Last active April 13, 2020 15:38
asuswrt merlin cloudflare ddns update
#!/bin/sh
# /jffs/scripts/ddns-start
zone=<zone_id>
record=<record_id>
token=<bearer_token>
fqdn=<fqdn>
myip=$(/usr/sbin/nvram get wan0_ipaddr)
static void Main(string[] args)
{
Run().GetAwaiter().GetResult();
}
static async Task Run()
{
TcpClient client = new TcpClient("127.0.0.1", 8080);
NetworkStream stream = client.GetStream();

Keybase proof

I hereby claim:

  • I am ravage on github.
  • I am ruiribeiro (https://keybase.io/ruiribeiro) on keybase.
  • I have a public key ASAzNKxqsAGgOrQOCokdM3-0L0pAhyBbAwJTaf0L8BY00Qo

To claim this, I am signing this object: