Skip to content

Instantly share code, notes, and snippets.

@aruiz
aruiz / Main.java
Created March 14, 2023 11:57
Calling external methods with Java ffm
import java.lang.foreign.*;
import java.lang.foreign.Arena;
import static java.lang.foreign.ValueLayout.ADDRESS;
import static java.lang.foreign.ValueLayout.JAVA_INT;
public class Main {
public static void main(String[] args) {
try (var arena = Arena.openConfined()) {
var allocator = SegmentAllocator.nativeAllocator(arena.scope());
var linker = Linker.nativeLinker();
@aruiz
aruiz / gpo_group_drivemap.ps1
Created February 27, 2023 15:25
PowerShell Script to map a drive in a GPO for a given group
$domain = "domain.local"
$gpname = "GPO Name"
$gpgroup = "Group"
$mount_template = @"
<?xml version="1.0" encoding="utf-8"?>
<Drives clsid="{8FDDCC1A-0C3C-43cd-A6B4-71A6DF20DA8C}">
<Drive clsid="{935D1B74-9CB8-4e3c-9914-7DD559B7A417}" name="T:" status="T:" image="2" changed="{1}" uid="{0}" bypassErrors="1">
<Properties action="U" thisDrive="SHOW" allDrives="NOCHANGE" userName="" path="\\SERVERHOST\NETWORKDRIVE" label="NetworkDrive" persistent="1" useLetter="1" letter="T"/>
/* test.c -- The test command.. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2007,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
import xml.etree.ElementTree as ET
from urllib.parse import urlparse, parse_qs
import github
ID = ""
SECRET = ""
COMMENT_TEMPLATE ="""Hello stranger, thanks for your contribution to GNOME.
Unfortunately the GNOME repositories in the GitHub mirror do not accept pull requests.
[GtkTemplate (ui = "/org/gnome/calculator/math-window.ui")]
public class MathWindow : Gtk.ApplicationWindow
{
[GtkChild]
private Gtk.MenuButton menu_button;
[GtkCallback]
private void scroll_changed_cb (Gtk.Adjustment adjustment)
{
return;
package main
import (
"log"
"net/http"
"io/ioutil"
)
type MyHandler struct {
payload []byte
@aruiz
aruiz / go-test.go
Last active January 4, 2016 19:59
package main
import (
"log"
"net/http"
"io/ioutil"
)
type MyHandler struct {
payload []byte