Skip to content

Instantly share code, notes, and snippets.

@arnavdugar
arnavdugar / xor.py
Created December 17, 2023 22:37
AIS XOR
#!/usr/bin/env python3
import itertools
import numpy as np
valid_characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ. '
valid_characters = set(ord(c) for c in valid_characters)
code = '7a5a2e3404405c476317125d5c5b2021515d4a152d2b515956472664105656403764125b5445363014464a15372c105a19543030035b575a2e3d515d4a1522261e414d1537211d514a562c34144717'
y = np.array([i for i in bytes.fromhex(code)])
@arnavdugar
arnavdugar / code-breaker.js
Last active December 17, 2023 06:50
AIS Code Breaker
const csrfmiddlewaretoken = "<token>";
const characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
const selectedCharacters = [];
for (let current of characters) {
const response = await fetch("https://hack.ainfosec.com/challenge/submit-answer/", {
"headers": {
"content-type": "application/x-www-form-urlencoded; charset=UTF-8",
},
"referrerPolicy": "same-origin",
public class Buffer<T> {
private T[] buffer;
private uint start = 0;
private uint length = 0;
public Buffer(uint size){
buffer = new T[size];
}
@arnavdugar
arnavdugar / bananabread.txt
Last active August 3, 2022 17:06
Banana Bread Recipe
Ingredients:
- 56.5 g (4 tablespoons) unsalted butter
- 56.5 g (4 tablespoons) apple sauce
- 201 g (1 cup) granulated sugar
- 2 large eggs
- 4 extra ripe bananas
- 0.5 teaspoon baking soda
- 0.5 teaspoon baking powder
- 240 g (2 cups) all-purpose flour
- 1/2 teaspoon salt
@arnavdugar
arnavdugar / rename.py
Created December 23, 2015 04:40
Batch Renaming Template
#!/usr/bin/env python3
import os, sys
def process(filename):
# Add Rename Logic Here
if 'foo' in filename:
filename = filename.replace('foo', 'bar')
return filename
@arnavdugar
arnavdugar / arduino.py
Created December 2, 2015 07:19
Reading and Writing to an Arduino Board
import serial
import struct
import subprocess
import threading
import time
def list_devices():
cmd = "ls /dev/tty.usbmodem* /dev/cu.usbmodem*"
process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@arnavdugar
arnavdugar / queue.c
Created November 30, 2015 09:19
Queue
#include "queue.h"
#include <stdlib.h>
#include <stdio.h>
void queue_build(list_queue_t *queue) {
queue->first = 0;
queue->last = 0;
queue->size = 0;
}
@arnavdugar
arnavdugar / stack.c
Created November 30, 2015 09:18
Stack
#include "stack.h"
#include <stdlib.h>
#include <stdio.h>
void stack_build(list_stack_t *stack) {
stack->first = 0;
stack->size = 0;
}
void stack_push(list_stack_t *stack, type value) {
@arnavdugar
arnavdugar / wtf
Created October 27, 2015 20:12
Search Urban Dictionary From Command Line
#!/usr/bin/env python3
import json
import sys
import textwrap
import urllib.parse
import urllib.request
url = 'http://api.urbandictionary.com/v0/define'
term = ' '.join(word for word in sys.argv[1:])
@arnavdugar
arnavdugar / sshcs
Created September 3, 2015 08:07
Berkeley SSH Login Tool
#!/usr/bin/env python3
import argparse
import json
import os
from subprocess import call
config_file = '~/.sshcs'
config_file = os.path.expanduser(config_file)