Skip to content

Instantly share code, notes, and snippets.

@safiire
safiire / pokémon_decrypt.c
Last active July 12, 2024 23:43
This is a C program to decrypt pokémon files
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#define NICKNAMED(x) ((x & 0x80000000) >> 31)
#define IS_EGG(x) ((x & 0x40000000) >> 30)
#define SP_DEF_IV(x) ((x & 0x3e000000) >> 25)
#define SP_ATT_IV(x) ((x & 0x01f00000) >> 20)
@safiire
safiire / day_two.rb
Last active December 3, 2023 21:17
Advent of Code 2023 Day 2
#!/usr/bin/env ruby
INPUT_FILE = 'part_one.input'
View = Data.define(:r, :g, :b) do
REGEX = /(\d+) red|(\d+) green|(\d+) blue/
def total = r + g + b
def power = r * g * b
def +(o) = self.class[r + o.r, g + o.g, b + o.b]
@safiire
safiire / day_one.rb
Last active December 2, 2023 02:22
Advent of Code 2023 Day 1
#!/usr/bin/env ruby
input = File.read('day_one.input')
Token = Data.define(:forward, :backward)
Tokens = {
eightwo: Token[8, 2],
eighthree: Token[8, 3],
fiveight: Token[5, 8],
nineight: Token[9, 8],
@safiire
safiire / lowpass.cpp
Created July 8, 2014 04:09
One Zero Low Pass Filter
#include <iostream>
#include <complex>
#define PI 3.141592653589793
#define SAMPLE_RATE 64
using namespace std;
// This lowpass is a weighted moving average
// If you change the + to - it will become a highpass filter
@safiire
safiire / rigol_screenshot.rb
Created February 6, 2023 04:29
Grab a screenshot of my Rigol 1054 off the LAN and convert it to png
#!/usr/bin/env ruby
require 'csv'
require 'socket'
require 'tempfile'
IP = '192.168.0.24'
PORT = 5555
class Screenshot
@safiire
safiire / delete_reddit_comments.sh
Last active October 12, 2022 17:50
Delete all My Reddit Comments
#!/bin/bash
LIMIT='100'
SLEEP='1'
TOKEN='xxxxxxx-xxxxxxxxxxxxxxxxxx-xxxx-xxxxxx'
USERNAME='username'
# Delete a comment by id
function delete_comment() {
#!/usr/bin/env python
from pwn import *
context(arch='amd64', log_level='info')
if len(sys.argv) >= 2:
use_one_gadget = True
libc_so_filename = './libc-2.23.so'
print("Using libc %s" % libc_so_filename)
@safiire
safiire / passport_time.rb
Created September 10, 2021 04:37
Decode a Vaccine Passport QR code and Display Contents
#!/usr/bin/env ruby
require 'base64'
require 'json'
require 'zlib'
# Requirements:
# Debian: apt-get install zbar-tools
# OSX: brew install zbar
@safiire
safiire / netstat.rb
Created February 25, 2019 05:23
Grab Netstat from "hackback" box on HTB
#!/usr/bin/env ruby
require 'uri'
require 'net/http'
require 'json'
Url = 'http://hackback:6666/netstat'
puts "Grabbing #{Url}"
uri = URI.parse(Url)
@safiire
safiire / hotp.rb
Last active April 1, 2019 03:47
A script to calculate an HOTP code
#!/usr/bin/env ruby
require 'base32'
require 'openssl'
# Script to calculate HOTP so I don't have to use my phone
class HOTP
def initialize(original_secret, counter = 0)
secret = Base32.decode(original_secret)