Skip to content

Instantly share code, notes, and snippets.

View Spandamn's full-sized avatar

Spandan Punwatkar Spandamn

View GitHub Profile
/**
* Matchmaker
* Pokemon Showdown - http://pokemonshowdown.com/
*
* This keeps track of challenges to battle made between users, setting up
* matches between users looking for a battle, and starting new battles.
*
* @license MIT
*/
@Spandamn
Spandamn / ChatBot.java
Created February 24, 2020 16:10
ChatBOT Test
/**
* ChatBot.java
* http://programmingforliving.com
*/
//package com.pfl.samples.jee7.websocket;
import java.io.*;
import java.net.URI;
import javax.websocket.ClientEndpoint;
@Spandamn
Spandamn / replace.js
Last active November 28, 2019 06:22
Replaces all instances of a string with another one in a folder, recursively.
let glob = require('glob')
let fs = require('fs')
let getDirectories = function (src, callback) {
glob(src + '/**/*', callback);
};
getDirectories('./', function (err, res) {
if (err) {
console.log('Error', err);
} else {
res.forEach(file => {
@Spandamn
Spandamn / message_dump.js
Last active July 14, 2021 13:51
Parses messages.json file from Instagram data dumps and creates different files containing Direct Messages for different users.
/**
* Written by Spandan Punwatkar
* https://github.com/Spandamn
* Requires node.js: nodejs.org
*/
const fs = require('fs');
let messages = JSON.parse(fs.readFileSync('./messages.json').toString()); // Converts the JSON file to an object
@Spandamn
Spandamn / fix_subtitle.js
Last active October 14, 2018 06:30
Something to fix your subtitles. Edit according to your needs
//Requires... Node.js 6?
'use strict';
let fs = require('fs');
let fileName = "Bee Movie.srt"; //Input the name of the subtitle file here.
let file = fs.readFileSync(`./${fileName}`).toString();
let delay = 2; //If the subtitle is fast, input a positive number. If its lagging, input a negative number.
let mili = 500; //The thing after the comma, whatever its called. Im assuming it adds to seconds
let indisubs = file.split('\n');
for (let i = 0; i < indisubs.length; i++) {
@Spandamn
Spandamn / items.js
Created May 23, 2018 16:01
mods/linked/items.js for Linked
'use strict';
exports.BattleItems = {
leppaberry: {
inherit: true,
onUpdate: function (pokemon) {
if (!pokemon.hp) return;
let moveSlot = pokemon.getMoveData(pokemon.getLastMoveAbsolute());
if (moveSlot && moveSlot.pp === 0) {
pokemon.addVolatile('leppaberry');
@Spandamn
Spandamn / moves.js
Last active May 23, 2018 15:59
mods/linked/moves.js for Linked
'use strict';
exports.BattleMovedex = {
/**
* Artificial priority
*
*/
pursuit: {
inherit: true,
beforeTurnCallback: function (pokemon, target) {
@Spandamn
Spandamn / statuses.js
Last active May 23, 2018 16:00
mods/linked/statuses.js for Linked
'use strict';
exports.BattleStatuses = {
slp: {
inherit: true,
onBeforeMove: function (pokemon, target, move) {
if (this.effectData.timerDecreased !== this.turn) {
this.effectData.timerDecreased = this.turn;
if (pokemon.hasAbility('earlybird')) {
pokemon.statusData.time--;
@Spandamn
Spandamn / scripts.js
Last active May 23, 2018 15:59
mods/linked/scripts.js for Linked
'use strict';
exports.BattleScripts = {
runMove: function (move, pokemon, targetLoc, sourceEffect, zMove, externalMove) {
let target = this.getTarget(pokemon, zMove || move, targetLoc);
if (!sourceEffect && toId(move) !== 'struggle' && !zMove) {
let changedMove = this.runEvent('OverrideAction', pokemon, target, move);
if (changedMove && changedMove !== true) {
move = changedMove;
target = null;
@Spandamn
Spandamn / scripts.js
Last active February 24, 2017 13:25
Full Potential Scripts.js by Spandan
'use strict';
exports.BattleScripts = {
getDamage : function(pokemon, target, move, suppressMessages) {
if (typeof move === 'string') move = this.getMove(move);
if (typeof move === 'number') {
move = {
basePower: move,
type: '???',