Skip to content

Instantly share code, notes, and snippets.

View Markkop's full-sized avatar
Keeping up with AI

Marcelo Kopmann Markkop

Keeping up with AI
View GitHub Profile
@Markkop
Markkop / use-wakfu-java.sh
Created April 12, 2020 00:36
Change Wakfu config to use it own Java version
echo "Starting..."
if [ ! -d jre/linux/x64/bin ]
then
echo "no ./jre/linux/x64/bin folder found"
exit
fi
chmod u+x jre/linux/x64/bin/*
@Markkop
Markkop / parseEffect.js
Created September 28, 2020 15:54
A javascript code to parse Wakfu's action effects description
// The following raw data is obtained from Wakfu's CDN
// https://www.wakfu.com/en/forum/332-development/236779-json-data
import actionsData from '../../data/raw/actions.json'
import statesData from '../../data/raw/states.json'
import jobsData from '../../data/raw/jobs.json'
const elementMap = {
1: {
en: 'Fire',
pt: 'Fogo',
@Markkop
Markkop / _document.js
Created January 23, 2021 14:53
NextJS _document.js file with script tags
import Document, { Html, Head, Main, NextScript } from 'next/document'
class MyDocument extends Document {
render () {
return (
<Html>
<Head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
@Markkop
Markkop / _app.js
Created January 23, 2021 15:00
NextJS _app.js with custom Head and NavBar
import '../styles/globals.css'
import NavBar from '../components/NavBar'
import Head from 'next/head'
function MyApp ({ Component, pageProps }) {
return (
<>
<Head>
<title>Tarrafa Hackerclub</title>
<link rel="icon" href="/favicon.ico" />
@Markkop
Markkop / oldTestUtils.js
Created October 4, 2021 18:53
The Discord mock I used to test Corvo Astral commands
// Taken from https://github.com/Markkop/corvo-astral/blob/ea51ce51d0/tests/testUtils.js
import config from '../src/config'
const { defaultConfig: { partyChannel } } = config
/**
* Mocks a channel message to match properties from a Discord Message.
* Note that channel messages has actually Collection type and here we're treating them
* as arrays and enriching their properties to have the same as a Discord Collection.
*
@Markkop
Markkop / getSublimationsEffects.js
Created October 4, 2021 19:43
Old sublimation effects importer
// Taken from https://github.com/Markkop/corvo-astral/blob/ea51ce51d0/src/importers/sublimations/getSublimationsEffects.js
import { saveFile, openFile } from '../../utils/files'
import axios from 'axios'
/**
* Execute this script.
*/
export async function getSublimationsEffects () {
const sublimations = openFile('data/raw/sublimations/sublimations.json')
@Markkop
Markkop / getAlmanaxBonus.js
Created October 4, 2021 19:47
Get the Almanax Bonus for the current day
**
* @typedef AlmanaxEvent
* @property { String } firstDate
* @property { String } name
* @property { String } text
*/
/**
* Calculate today's Almanax Bonus
* @returns { AlmanaxEvent }
@Markkop
Markkop / index.js
Last active October 5, 2021 13:45
Bot code from the project's first commit
// Taken from: https://github.com/Markkop/corvo-astral/commit/6455dfe7d2fd0258a2e45703cbdad7f4c8fab12c
import Discord from 'discord.js'
import { getAlmanaxBonus } from './helpers'
const client = new Discord.Client()
const prefix = '.'
client.on('message', function (message) {
if (message.author.bot) return
@Markkop
Markkop / canHandle.ts
Last active January 14, 2022 18:11
canHandle example
canHandle(handlerInput: HandlerInput) {
return handlerInput.requestEnvelope.request.type === 'LaunchRequest'
|| (handlerInput.requestEnvelope.request.type === 'IntentRequest'
&& (
handlerInput.requestEnvelope.request.intent.name === 'PlayStreamIntent'
|| handlerInput.requestEnvelope.request.intent.name === 'AMAZON.ResumeIntent'
|| handlerInput.requestEnvelope.request.intent.name === 'AMAZON.LoopOnIntent'
|| handlerInput.requestEnvelope.request.intent.name === 'AMAZON.NextIntent'
|| handlerInput.requestEnvelope.request.intent.name === 'AMAZON.PreviousIntent'
|| handlerInput.requestEnvelope.request.intent.name === 'AMAZON.RepeatIntent'
@Markkop
Markkop / canHandle.ts
Last active January 14, 2022 18:11
canHandle example with ask-sdk-core helpers
import { HandlerInput, getRequestType, getIntentName } from 'ask-sdk-core';
const PlayStreamRequestTypes = ['LaunchRequest', 'IntentRequest'];
const PlayStreamRequestIntentNames = [
'PlayStreamIntent',
'AMAZON.ResumeIntent',
'AMAZON.LoopOnIntent',
'AMAZON.NextIntent',
'AMAZON.PreviousIntent',
'AMAZON.RepeatIntent',