Skip to content

Instantly share code, notes, and snippets.

@Rapptz
Rapptz / xclip.cpp
Last active February 21, 2024 03:50
Windows port of xclip
// The MIT License (MIT)
// Copyright (c) 2014 Rapptz
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
@Rapptz
Rapptz / keepass.md
Last active August 13, 2023 09:15
Setting up KeePass

Setting Up KeePass

I frequently see discussions around which password manager to use. I personally use [KeePass][main]. This is an open source program that allows you to have control in your data. The database format is encrypted so as long as you keep your master password secure, the chance of someone getting access to your passwords is practically zero.

This document is just meant as a signpost to steer you in the right direction of how to set up KeePass across multiple operating systems and have your file synced in the cloud all while paying $0 and not having to set up a single server to do so.

Why KeePass?

You can skip this if you don't care

@Rapptz
Rapptz / map_generator.py
Created January 26, 2016 08:42
The random map generator for Splatoon tournaments.
from __future__ import division
import random
from collections import Counter, namedtuple
import bisect
import math
# for my own purposes.
debug = False
def weighted_choice(choices):
@Rapptz
Rapptz / changelog.md
Last active October 28, 2022 14:42
Changelog for R. Danny

Changelog (Updated Jan. 29th 2016)

The bot has been completely rewritten.

For feature requests or questions feel free to ping/private message @Danny.

Big changes

  • Most things don't require quotes anymore. A lot of people had a hard time with the concept of adding quotes to things so if it's the last argument of a command
@Rapptz
Rapptz / custom_commands.py
Last active October 28, 2022 14:42
Showing off custom commands using discord.ext
import discord
from discord.ext import commands
import json, inspect
import functools
import re
# some JSON set up for our storage because >lazy<
class CustomCommandEntry:
__slots__ = ['name', 'content', 'guild_id']
import requests
import json
USER_TOKEN = 'token'
API_BASE = 'https://discordapp.com/api'
class Embeds:
def __init__(self, data):
basic_keys = ('title', 'type', 'description', 'url', 'timestamp', 'color',
'footer', 'image', 'thumbnail', 'provider', 'author')
2016-11-02 17:31:20 #python_discord-py @luke#7172: uhhh
2016-11-02 17:31:36 #python_discord-py @Fuyukai desu#0588: what
2016-11-02 17:31:46 #python_discord-py @luke#7172: :/
2016-11-02 17:31:50 #python_discord-py @luke#7172: I don't know how to do this
2016-11-02 17:32:27 #python_discord-py @luke#7172: I need to get info of another shard
2016-11-02 17:33:03 #python_discord-py @luke#7172: like server amount, etc
2016-11-02 17:33:07 #python_discord-py @luke#7172: whats the best method to do this
2016-11-02 17:34:07 #python_discord-py @Fuyukai desu#0588: ipc
2016-11-02 17:34:37 #python_discord-py @luke#7172: Indian Penal Code?
2016-11-02 17:34:41 #python_discord-py @Recchan#4305: who shards
using Discord;
namespace Yonom.DiscordTools
{
static class DiscordAvatar
{
// for documentation purposes only
private static enum DefaultAvatars
{
blurple = 0,
@Rapptz
Rapptz / discord_qol.md
Last active October 28, 2022 14:40
For Jake

I restricted these to client-only QoL features that I thought were small.

  • Reverse sorting search
  • Group by Guild in Emoji panel so you can see what guild an emoji is in
  • Disabling "GIF" or "Gift" buttons in the message box
  • Hover over for complete timestamp on messages
    • Maybe the same for embed timestamps?
  • More time information in call messages (e.g. how long it lasted for) (I know it's provided in the message since I have it in d.py)
  • Lock channels so you don't accidentally move them by dragging (this one might be less trivial iunno)
  • Character count indicator for knowing if you're reaching 2000 characters. too hard apparently
@Rapptz
Rapptz / docs.md
Last active October 28, 2022 14:40 — forked from Zomatree/docs.md

Overview

messages can be sent with the components key to add buttons and other components (when discord brings them out), you can edit and add new buttons via editing the message, this is useful for the disabled key to stop people from clicking it.

Example Payload

{
    "content": "this is an example message for components",
    "components": [
        {"type": 1, "components": [
 {"type": 2, "style": 2, "label": "Button 1", "custom_id": "1"},