Skip to content

Instantly share code, notes, and snippets.

@Kale-Ko
Kale-Ko / replace.cpp
Last active May 16, 2024 09:26
Utility to replace any string with any other string in a passed string or file.
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
int stringReplace(std::string& string, const std::string& from, const std::string& to) {
int count = 0;
std::size_t pos = string.find(from);
if (pos != std::string::npos) {
@Birch-san
Birch-san / model_watch.py
Last active May 16, 2024 09:26
Watch your activation norms fly into the sunset
# Contains MIT-licensed code from wandb
# https://github.com/wandb/wandb/blob/main/LICENSE
# This gist is MIT-licensed (Copyright Alex Birch)
from torch import Tensor, FloatTensor
from torch.nn import Module
from torch.utils.hooks import RemovableHandle
import torch
from typing import List, Callable, Dict, Sequence, Optional, Tuple, Any
from wandb.wandb_torch import log_track_init, log_track_update
# It's only a POC for now
defmodule ContextBase do
@moduledoc """
Abstracts away common schema functions, such as list, get, create, update, delete, etc.
Assumes that the schema module has a `changeset` function.
Usage:
defmodule MyContext do
use ContextBase, repo: MyApp.Repo, schema: MyApp.MySchema
end
@steven-michaud
steven-michaud / ThirdPartyKexts.md
Last active May 16, 2024 09:19
Running Third Party Kernel Extensions on Virtualization Framework macOS Guest VMs

Running Third Party Kernel Extensions on Virtualization Framework macOS Guest VMs

As of macOS 12 (Monterey), Apple's Virtualization framework has nice support for macOS guest virtual machines, but with severe limitations: For example you can't install a macOS guest on Intel Macs, install guests with newer versions of macOS than the host, copy and paste between the host and the guest, or install third party kernel extensions in the guest. As usual for Apple, the functionality they do support is nicely implemented, but they've left out so much that the result is only marginally useful -- at least compared to

@motoyasu-saburi
motoyasu-saburi / lack_escape_content-disposition_filename.md
Last active May 16, 2024 09:18
Land Mine named "Content-Disposition > filename"

TL;DR

  • I found 1 browser, 1 language, and 15 vulnerabilities in { Web Framework, HTTP Client library, Email library / Web Service, etc }
  • All the vulnerabilities I found were found from a single perspective (I investigated maybe 50-80 products).
  • The RFC description of the problem (rather confusingly) describes the requirements for this problem, while the WHATWG > HTML Spec is well documented.
  • The problem is clearly targeted at the Content-Disposition fields filename and filename*.
  • This problem affects HTTP Request/Response/Email in different ways.
    • HTTP Request : request tampering (especially with file contents, tainting of other fields, etc.)
    • HTTP Response : Reflect File Download vulnerability
  • Email : Attachment tampering (e.g., extension and filename tampering and potential file content tampering)
@490398290
490398290 / com.adobe.Acrobat.Pro.plist
Created March 3, 2021 10:44 — forked from amandaw33/com.adobe.Acrobat.Pro.plist
Acrobat Pro DC plist to disable updating, cloud services etc - more info on keys: http://www.adobe.com/devnet-docs/acrobatetk/tools/PrefRef/Macintosh/Workflows.html
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DC</key>
<dict>
<key>FeatureLockdown</key>
<dict>
<key>bUpdater</key>
<false/>
@amandaw33
amandaw33 / com.adobe.Acrobat.Pro.plist
Last active May 16, 2024 09:17
Acrobat Pro DC plist to disable updating, cloud services etc - more info on keys: http://www.adobe.com/devnet-docs/acrobatetk/tools/PrefRef/Macintosh/Workflows.html
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DC</key>
<dict>
<key>FeatureLockdown</key>
<dict>
<key>bUpdater</key>
<false/>
@waseemR02
waseemR02 / cd all codes.txt
Created May 14, 2024 07:13
Just testing
calculator using c++:
#include<iostream>
using namespace std;
int main(){
char op;
float num1,num2;
cout<<("enter operator(+,-,*,/):");
cin>>op;
cout<<("enter two operends:");
@v0112358
v0112358 / mysql_memory_calculator.md
Last active May 16, 2024 09:13
MySQL Memory Calculator

MySQL 5.6

Base memory

SELECT ( @@key_buffer_size
+ @@query_cache_size
+ @@innodb_buffer_pool_size
+ @@innodb_log_buffer_size
+ @@innodb_additional_mem_pool_size )
/ (1024 * 1024 * 1024) AS BASE_MEMORY_GB;