Skip to content

Instantly share code, notes, and snippets.

View zhuowei's full-sized avatar

zhuowei

View GitHub Profile
@BuffaloWill
BuffaloWill / cloud_metadata.txt
Last active April 16, 2024 04:15
Cloud Metadata Dictionary useful for SSRF Testing
## IPv6 Tests
http://[::ffff:169.254.169.254]
http://[0:0:0:0:0:ffff:169.254.169.254]
## AWS
# Amazon Web Services (No Header Required)
# from http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html#instancedata-data-categories
http://169.254.169.254/latest/meta-data/iam/security-credentials/dummy
http://169.254.169.254/latest/user-data
http://169.254.169.254/latest/user-data/iam/security-credentials/[ROLE NAME]
@bellbind
bellbind / Shaders.metal
Last active October 26, 2021 16:02
[swift][osx] Metal programming with commandline (Xcode less)
//-*- mode: c++ -*-
// build:
// xcrun -sdk macosx metal -std=osx-metal1.1 Shaders.metal -o shaders.air
// xcrun -sdk macosx metal-ar rcs Shaders.metalar Shaders.air
// xcrun -sdk macosx metallib -o Shaders.metallib Shaders.metalar
#include <metal_stdlib>
kernel void square(const device float* input [[buffer(0)]],
device float* output [[buffer(1)]],
metal::uint id [[thread_position_in_grid]]) {
@dropmeaword
dropmeaword / browser_history.md
Last active April 5, 2024 17:37
Playing around with Chrome's history

Browser histories

Unless you are using Safari on OSX, most browsers will have some kind of free plugin that you can use to export the browser's history. So that's probably the easiest way. The harder way, which seems to be what Safari wants is a bit more hacky but it will also work for other browsers. Turns out that most of them, including Safari, have their history saved in some kind of sqlite database file somewhere in your home directory.

The OSX Finder cheats a little bit and doesn't show us all the files that actually exist on our drive. It tries to protect us from ourselves by hiding some system and application-specific files. You can work around this by either using the terminal (my preferred method) or by using the Cmd+Shft+G in Finder.

Finder

Once you locate the file containing the browser's history, copy it to make a backup just in case we screw up.

@jcarbaugh
jcarbaugh / discover.py
Created September 30, 2015 17:33
DIAL examples
import httplib
import socket
import StringIO
# generic
SSDP_ALL = 'ssdp:all'
UPNP_ROOT = 'upnp:rootdevice'
# devices
DIAL = 'urn:dial-multiscreen-org:service:dial:1'
@jtbandes
jtbandes / xcpaste.md
Last active August 12, 2018 21:35
xcpaste — copy formatted code as HTML/CSS

example

@pudquick
pudquick / parse_pbzx2.py
Created April 8, 2015 05:27
A pbzx stream decoder for the format found within Yosemite package payloads.
# v2 pbzx stream handler
# My personal writeup on the differences here: https://gist.github.com/pudquick/29fcfe09c326a9b96cf5
#
# Pure python reimplementation of .cpio.xz content extraction from pbzx file payload originally here:
# http://www.tonymacx86.com/general-help/135458-pbzx-stream-parser.html
#
# Cleaned up C version (as the basis for my code) here, thanks to Pepijn Bruienne / @bruienne
# https://gist.github.com/bruienne/029494bbcfb358098b41
import struct, sys
execve("/system/bin/qmuxd", ["qmuxd"], [/* 20 vars */]) = 0
mprotect(0xb6f6d000, 4096, PROT_READ) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
gettid() = 7644
set_tls(0xb6f6ef24, 0xffffffb8, 0, 0xb6f6ef24, 0xb6f6f154) = 0
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0) = 0xb6f5b000
madvise(0xb6f5b000, 8192, 0xc /* MADV_??? */) = -1 EINVAL (Invalid argument)
sigaltstack({ss_sp=0xb6f5b000, ss_flags=0, ss_size=8192}, NULL) = 0
sigaction(SIGABRT, {0xb6f5da91, [], SA_RESTART|SA_SIGINFO|SA_ONSTACK}, NULL, 0xb6f96e7c) = 0
sigaction(SIGBUS, {0xb6f5da91, [], SA_RESTART|SA_SIGINFO|SA_ONSTACK}, NULL, 0xb6f96e7c) = 0
@CodaFi
CodaFi / Nat.swift
Last active September 24, 2021 19:46
// Playground - noun: a place where people can play
protocol ℕ {
static func construct() -> Self
static var value : UInt { get }
}
struct Zero : ℕ {
static func construct() -> Zero {
return Zero()
@winocm
winocm / gist:8681816
Created January 29, 2014 04:23
Mispy's assembly.
/* 0x00000000 */ 0x26000618, /* cpsid if, #0x13 */
/* 0x00000004 */ 0x0204202a, /* mov r1, #(0x10 << 8) */
/* 0x00000008 */ 0x0002206a, /* mov r3, #0x8 (.LmispWrite) */
/* .LmispWrite: */
/* 0x0000000C */ 0x0013600a, /* mov r0, #('M') */
/* 0x00000010 */ 0x021a6009, /* orr r0, #('i') << 08 */
/* 0x00000014 */ 0x041ce009, /* orr r0, #('s') << 16 */
/* 0x00000018 */ 0x061c2009, /* orr r0, #('p') << 24 */
/* 0x0000001C */ 0x02046027, /* cmp r1, #(0x11 << 8) */
/* 0x00000020 */ 0x20002217, /* strne r0, [r1, #0!] */
@winocm
winocm / mispy.c
Created January 28, 2014 23:11
Happy birthday @M1sp! <3
#include <stdio.h>
#include <stdint.h>
#include <strings.h>
#include <stdlib.h>
#define __t uint32_t
#define __r return
typedef struct _$n{union{struct{__t o:5;__t rt:4;__t ra:4;__t z:4;__t sreg:8;__t _rs$v:7;}____;__t e;}u;} _$n;typedef struct _$i {
union{struct{__t o:5;__t z:4;__t _:16;__t __:7;}____;__t e;}u;}_$i;typedef struct _$l {union{struct{__t o:5;__t rt:4;__t ra:4;