Skip to content

Instantly share code, notes, and snippets.

@littletsu
littletsu / ping.js
Last active October 13, 2018 00:36
// The command will be activated using _ping, since the filename is ping & our prefix is _
exports.run = (client, message, args) => {
// This sends a message to the channel, containing the string 'Pong!'
message.channel.send('Pong!');
}
// The command reloads other commands, using the command handler from our series
exports.run = (client, message, args, ops) => {
// We're going to be passing an extra argument, titled 'ops'
// We can choose what to pass into it via the server.js file
// Now, we can access ops.ownerID & it will return the ID defined at the top of server.js
// Check if author is the bot owner
if (message.author.id !== ops.ownerID) return message.channel.send('Sorry, only the owner can use this command.');
// If the two IDs aren't the same, it will return and send a message to the channel
// Require Packages -- You will need to install these
const Discord = require('discord.js');
const client = new Discord.Client(); // This uses the discord.js package to setup a client
// Constant Variables
const prefix = '_'; // This can be changed to anything you want
const ownerID = 'yourID'; // This will be used in future videos
// Listener Events
client.on('message', message => {
// Require Packages -- You will need to install these
const Discord = require('discord.js');
const client = new Discord.Client(); // This uses the discord.js package to setup a client
// Constant Variables
const prefix = '_'; // This can be changed to anything you want
const ownerID = '144645791145918464'; // This will be used in future videos
// Listener Events
client.on('message', message => {
// Require Packages -- You will need to install these
const Discord = require('discord.js');
const client = new Discord.Client(); // This uses the discord.js package to setup a client
// Constant Variables
const prefix = '_'; // This can be changed to anything you want
const ownerID = '144645791145918464'; // This will be used in future videos
// First, we need to create an object containing the serverStats info
const serverStats = {
@littletsu
littletsu / tablas.js
Last active November 22, 2018 02:30
Tablas de Multiplicar en JavaScript (Funciona en Node.js y Navegador)
// Variables
let tabla = 2
let longitud = 10
// Codigo
for (i = 1; i < longitud + 1; i++) {
console.log(`${tabla}x${i} = ${tabla*i}`)
}
@littletsu
littletsu / main.cc
Last active July 4, 2020 22:13
Probably Working With All Programs SendInput
INPUT ip = {0};
ip.type = INPUT_KEYBOARD;
ip.ki.wScan = 0x39; // hardware scan code for key (http://www.philipstorr.id.au/pcbook/book3/scancode.htm)
ip.ki.dwFlags = KEYEVENTF_SCANCODE;
SendInput(1, &ip, sizeof(INPUT));
ip.ki.dwFlags = KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP;
SendInput(1, &ip, sizeof(INPUT));
@littletsu
littletsu / wrapper.js
Created September 18, 2018 05:52
Mini wrapper around discord API. Dependencies: snekfetch, ws. Heavily based in rylib by ry00001 (https://github.com/ry00001)
const fetch = require('snekfetch')
const ws = require("ws")
var logHeartbeat = false
// Weebsocket
get('gateway').then(gateway => {
let weebsocket = new ws(gateway.url)
@littletsu
littletsu / pd_bindings.tcl
Created October 9, 2021 04:35
Pure Data Toggle DSP Hotkey
# add this before global hotkeys are defined
# then replace or add the desired toggle dsp hotkey with ::pd_bindings::toggle_dsp
# example: "bind_capslock all $::modifier-Key w {::pd_bindings::toggle_dsp}"
# (replacing CTRL-W Exit hotkey with toggle dsp)
set ::pd_bindings::dsp_on false
proc ::pd_bindings::toggle_dsp {} {
if {$::pd_bindings::dsp_on} {
pdsend "pd dsp 0"
@littletsu
littletsu / hydraviz.js
Created January 9, 2022 03:49
Hydra visualizer
// credits to Asdrúbal Gomez for initial code snippet
noise(3,0.1,7)
.rotate(1,-1,-2).mask(shape(() => a.fft[4]*2 || 20))
.colorama(() => a.fft[0]*3 || 1)
.modulateScale(o0)
.modulateScale(o0,1,)
.scale(() => a.fft[3]*2 || 1)
.blend(o0)
.blend(o0)