Skip to content

Instantly share code, notes, and snippets.

@joeytwiddle
joeytwiddle / async-await-forEach-alternatives.md
Last active October 24, 2025 14:23
Do not use forEach with async-await

Do not use forEach with async-await

TLDR: Use for...of instead of forEach() in asynchronous code.

For legacy browsers, use for(...;...;...) or [].reduce()

To execute the promises in parallel, use Promise.all([].map(...))

The problem

@sunmeat
sunmeat / different files.java
Last active October 24, 2025 14:26
recycler view first simple example android
MainActivity.java:
package com.sunmeat.myapplication;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
@kanibaspinar
kanibaspinar / eternalblue2012.py
Created May 17, 2017 22:20
EternalBlue Windows 8 & Server 2012 - Bypass Windows 10
#!/usr/bin/python
from impacket import smb
from struct import pack
import os
import sys
import socket
'''
EternalBlue exploit for Windows 8 and 2012
The exploit might FAIL and CRASH a target system (depended on what is overwritten)
@steviecoaster
steviecoaster / Wait-File.ps1
Created October 21, 2025 18:39
Implement a FileSystemWatcher in PowerShell
function Wait-File {
<#
.SYNOPSIS
Monitors a file system path for changes and executes a script block in response to specified events.
.DESCRIPTION
The Wait-File function creates a FileSystemWatcher to monitor a specified directory for file system changes.
It registers event handlers for specified events (Created, Changed, Deleted, Renamed) and executes a
custom action when those events occur. The function runs continuously until manually stopped (Ctrl+C).
@nemotoo
nemotoo / .gitattributes
Last active October 24, 2025 14:20
.gitattributes for Unity3D with git-lfs
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
@ruvnet
ruvnet / *claude.md
Last active October 24, 2025 14:14
The Claude-SPARC Automated Development System is a comprehensive, agentic workflow for automated software development using the SPARC methodology with the Claude Code CLI

Claude-SPARC Automated Development System For Claude Code

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Overview

The SPARC Automated Development System (claude-sparc.sh) is a comprehensive, agentic workflow for automated software development using the SPARC methodology (Specification, Pseudocode, Architecture, Refinement, Completion). This system leverages Claude Code's built-in tools for parallel task orchestration, comprehensive research, and Test-Driven Development.

Features

@fortinmike
fortinmike / reclaim-disk-space.bat
Last active October 24, 2025 14:12
Aggressively reclaim disk space in a Windows partition
::
:: Reclaims Windows disk space in a "destructive" manner (can't uninstall service packs and updates afterwards, etc.).
:: Use at your own risk. Useful for Windows installations in space-constrained environments, such as a small Boot Camp
:: partition on a Mac.
::
:: [IMPORTANT] It is strongly suggested to make a full-disk backup of your Windows partition before running this script,
:: as you can't roll back service packs and updates afterwards.
::
:: [IMPORTANT] Run this script as admin (required to run `Dism.exe` among other things).
::
import SimpleITK as sitk
# read image
inputImage = sitk.ReadImage('/path/to/input.nii.gz')
# get result in the form of a numpy array
npa_res = my_algorithm(sitk.GetArrayFromImage(inputImage)) # my_algorithm does something fancy
# Converting back to SimpleITK (assumes we didn't move the image in space as we copy the information from the original)
result_image = sitk.GetImageFromArray(npa_res)
@ryanorsinger
ryanorsinger / list_comprehension_practice.py
Last active October 24, 2025 14:10
17 List Comprehension Exercises
# 17 list comprehension problems in python
fruits = ['mango', 'kiwi', 'strawberry', 'guava', 'pineapple', 'mandarin orange']
numbers = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 17, 19, 23, 256, -8, -4, -2, 5, -9]
# Example for loop solution to add 1 to each number in the list
numbers_plus_one = []
for number in numbers:
numbers_plus_one.append(number + 1)
@afawcett
afawcett / sfdoc.md
Last active October 24, 2025 14:10
Cursor Command to help Cursor Read Salesforce Docs

Background: I find Cursor struggles to retrieve content from Salesforce documentation links due to various approaches used such as as shadow dom and dynamic loading. This Cursor command leverages Cursors Browser Automation tool (needs to be explcitly enabled) to help give it a few more clues on how to deal with these pages. I initially built a shell script for it to call but then I discovered Cursor commands. So I built this command using Cursor itself once we had both figured this out - effectively it wrote its own instructions. Use at your own risk.

Usage: In Cursor type / and select Create Command enter sfdoc and press enter. Then paste the content below into the file. To use, use prompts like Read this https://developer.salesforce.com/docs... using /sfdoc


Extract Salesforce documentation content from [URL] using browser automation. The Salesforce docs use heavy JavaScript rendering with custom web components and shadow DOM. Follow this comprehensive approach based on successful s