Skip to content

Instantly share code, notes, and snippets.

View Pyker's full-sized avatar
🛠️
Hacking away

Pedro Cunha Pyker

🛠️
Hacking away
View GitHub Profile
@arunesh90
arunesh90 / ArchiveParser.js
Last active July 20, 2020 14:25
Archive parsing for Discord
// Quick and dirty parser for Discord's archives
const path = require('path')
const fs = require('fs')
const csv = require('csv')
const prompt = require('prompt')
let stats = {
messageCount: 0,
words: {},
wordsSorted: []
@ivanbrennan
ivanbrennan / show-256-colors.sh
Last active August 12, 2023 20:12
Use Bash to show all 256 colors supported by xterms
#!/usr/bin/env bash
PADDING='Padding'
main() {
local xterm_start=0 \
xterm_width=8 \
xterm_height=2
local cube_start=$((xterm_start + xterm_width * xterm_height)) \
@jagrosh
jagrosh / StatusEnum.java
Created February 7, 2018 23:13
Discord Status API snippet, part of the bot that runs https://discord.gg/jn7TAP8
/*
* Copyright 2018 John Grosh <john.a.grosh@gmail.com>.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@EvieePy
EvieePy / bot_example.py
Last active April 24, 2024 09:30
A Cogs Example for the rewrite version of - discord.py
import discord
from discord.ext import commands
import sys, traceback
"""This is a multi file example showcasing many features of the command extension and the use of cogs.
These are examples only and are not intended to be used as a fully functioning bot. Rather they should give you a basic
understanding and platform for creating your own bot.
These examples make use of Python 3.6.2 and the rewrite version on the lib.
@antirez
antirez / lmdb.tcl
Created April 28, 2017 15:40
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <antirez@gmail.com>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
@simonw
simonw / recover_source_code.md
Last active January 16, 2024 08:13
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@Rob--W
Rob--W / README.md
Last active August 8, 2020 03:02
Analysis of WOT 20151208
@sielay
sielay / gist:0aa4077829f35f5e0310f9e0cc9fdc71
Created August 10, 2016 10:06
Haproxy - Capture client IP when behind CloudFlare or not. Also keep x-forwarded-for in logs
frontend www-http
bind :80
bind *:443 ssl crt /etc/haproxy/certs no-sslv3
capture request header X-Forwarded-For len 50
acl is_cf req.hdr(cf-connecting-ip) -m found
http-request set-header X-Client-IP %[src] if !is_cf
http-request set-header X-Client-IP %[hdr(cf-connecting-ip)] if is_cf
import requests
import bz2
import simplejson
import re
test = {
"id" : "220333",
"regex" : "CoFHLib-\\[(?P<mc>.+?)\\](?P<version>.+?).jar"
}