Skip to content

Instantly share code, notes, and snippets.

@afdapone
afdapone / BinaryModules.js
Created September 6, 2021 16:24 — forked from brikis98/BinaryModules.js
Node.js performance tips
// Use built in or binary modules
var crypto = require('crypto');
var hash = crypto.createHmac("sha1",key).update(signatureBase).digest("base64");
@afdapone
afdapone / form.ejs
Created September 6, 2021 16:25 — forked from kanwarujjaval/form.ejs
Creating multiple forms with a single ejs file in node.js
<form action="<%= action %>" method="post">
<% if (fields.length) { %>
<% fields.forEach(function(field){ %>
<label><%= field.name %></label>
<input type="<%= field.type %>" name="<%= field.name %>" <% if (field.property) { %> <%= field.property %> <% } %> >
<% }) %>
<% } %>
<button type="submit"><%= title %></button> <!--Title for button is same as that of the page-->
// Customizable variables
var minValue = 0.00000001;
var maxLoss = 0.0000001;
var aimedProfit = 0.000005;
var maxOps = 50;
// Don't touch anything after this
var endResult = 0;
var ops = 0;
@afdapone
afdapone / repair-mysql-data.ps1
Created March 4, 2024 10:48 — forked from josemmo/repair-mysql-data.ps1
Repair MySQL data directory (for XAMPP)
# Based on this answer: https://stackoverflow.com/a/61859561/1956278
# Backup old data
Rename-Item -Path "./data" -NewName "./data_old"
# Create new data directory
Copy-Item -Path "./backup" -Destination "./data" -Recurse
Remove-Item "./data/test" -Recurse
$dbPaths = Get-ChildItem -Path "./data_old" -Exclude ('mysql', 'performance_schema', 'phpmyadmin') -Recurse -Directory
Copy-Item -Path $dbPaths.FullName -Destination "./data" -Recurse
@afdapone
afdapone / wp-config.php
Created April 24, 2024 10:11 — forked from MikeNGarrett/wp-config.php
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit.
// Database
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database.
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users)
// Explicitely setting url
@afdapone
afdapone / corsproxy.php
Created July 16, 2024 01:28 — forked from dropmeaword/corsproxy.php
simple CORS proxy in php
<?php
error_reporting( error_reporting() & ~E_NOTICE ); // evil
// config
$enable_jsonp = false;
$enable_native = false;
$valid_url_regex = '/.*/';
// ############################################################################
@afdapone
afdapone / README.md
Created August 8, 2024 02:28 — forked from delasy/HAMSTER-KOMBAT-PLAYGROUND-GAMES-PRMO-CODE-KEYS-GENERATOR.md
Hamster Kombat playground promo keys generator. BIKE, CLONE, CUBE, TRAIN games.

How To Use

node hamster-kombat-playground-games-promo-keys-generator.js

How To Setup

Update line with users you want to generate promo codes for:

@afdapone
afdapone / getElementsByText.js
Created January 18, 2025 10:50 — forked from leodutra/getElementsByText.js
Get DOM elements by text content
const getElementsByText = (text, parent) => {
if (!text) return []
const xpath = `//*[text()='${text}']`
const xpathResult = document.evaluate(
xpath,
parent || document,
null,
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
null
)
@afdapone
afdapone / twitter-font-awesome-4.css
Created April 10, 2025 13:35 — forked from bacoords/twitter-font-awesome-4.css
Update the Twitter / X Icon in Font Awesome 4
.fa.fa-twitter{
font-family:sans-serif;
}
.fa.fa-twitter::before{
content:"𝕏";
font-size:1.2em;
}