Skip to content

Instantly share code, notes, and snippets.

@thomasstr
thomasstr / disable-comments.php
Created November 15, 2023 08:11
disable-comments.php
<?php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php' || $pagenow === 'options-discussion.php') {
wp_redirect(admin_url());
exit;
}
AUTH:
domain_login:
driver = plaintext
public_name = LOGIN
client_send = : postmaster:password
ROUTERSTART:
domain:
driver = manualroute
domains = ! +local_domains
const Discord = require('discord.js');
const client = new Discord.Client();
client.once('ready', () => {
console.log('Ready!');
});
client.on('message', message => {
if (message.content === '!react-await') {
message.react('👍').then(() => message.react('👎'));
@thomasstr
thomasstr / realtime.js
Created February 6, 2021 15:05
Await for reaction Discord JS
const Command = require("../base/Command.js");
class Realtime extends Command
{
constructor (client)
{
super(client,
{
name: "realtime",
description: "Gets realtime stock values",
var arr = ["User1", "User2", "User3"];
message.channel.send({embed: {
color: 3447003,
author: {
name: client.user.username,
icon_url: client.user.avatarURL
},
title: "This is an embed",
url: "http://google.com",
/* Hello World OLED Test */
#include "SSD1306.h" // alias for `#include "SSD1306Wire.h"`
SSD1306 display(0x3c, 4, 5); // Initialise the OLED display using Wire library (D2 and D1 on NodeMCU)
void setup()
{
Serial.begin(9600);
display.init(); // Initialising the UI will init the display too.
display.flipScreenVertically();
display.normalDisplay();
var express = require('express')
, session = require('express-session')
, passport = require('passport')
, Strategy = require('./lib').Strategy
, app = express()
, path = require('path')
, engines = require('consolidate')
const conn = require('./knex/MySQL');
passport.serializeUser(function(user, done) {
@thomasstr
thomasstr / app.js
Last active October 23, 2018 07:30
const connection = require('./knex/MySQL');
var checkUser = conncetion.userExists("226018734496546817")
if (checkUser == 1) {
console.log("User exists");
else {
connection.createUser({
name: "Thomas Strømme",
id: "226018734496546817"
#<RUBG::Participant:0x007f91bdd414c0 @participant_id="77e81b3a-b646-4f98-bf98-5588c3b7d508", @actor="", @shard="pc-na", @dbnos=8, @assists=0, @boosts=3, @damage_dealt=942.960144, @death_type="byplayer", @headshot_kills=2, @heals=14, @kill_place=1, @kill_ranking_before=1000, @kill_ranking_gained=0, @kill_streaks=3, @kills=10, @last_kill_points=0, @last_win_points=0, @longest_kill=57.8827133, @most_damage=0, @name="StoneMountain64", @player_id="account.6c30f024b3ec4283baefd39f3cb5694e", @revives=0, @ride_distance=0, @road_kills=1, @team_kills=0, @time_survived=1385.811, @vehicle_destroys=0, @walk_distance=3190.1543, @weapons_acquired=11, @win_place=14, @win_ranking_before=1500, @win_ranking_gained=0, @overall_ranking_gained=0, @stats={"DBNOs"=>8, "assists"=>0, "boosts"=>3, "damageDealt"=>942.960144, "deathType"=>"byplayer", "headshotKills"=>2, "heals"=>14, "killPlace"=>1, "killPoints"=>1000, "killPointsDelta"=>0, "killStreaks"=>3, "kills"=>10, "lastKillPoints"=>0, "lastWinPoints"=>0, "longestKill"=>57.8827133,
<?php
function splitapng($data) {
$parts = array();
// Save the PNG signature
$signature = substr($data, 0, 8);
$offset = 8;
$size = strlen($data);
while ($offset < $size) {
// Read the chunk length