Skip to content

Instantly share code, notes, and snippets.

@webhaikal
webhaikal / DOM3D.js
Created March 27, 2024 13:06 — forked from OrionReed/dom3d.js
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@webhaikal
webhaikal / cube.py
Last active October 20, 2023 02:38
Python Cube
import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
# Define the vertices of the cube
vertices = (
(1, -1, -1),
(1, 1, -1),
(-1, 1, -1),
import java.util.Scanner;
import javax.crypto.spec.SecretKeySpec;
import javax.crypto.Cipher;
public class PasswordManager {
// Generate a secret key for the XChaCha20 algorithm
private static SecretKeySpec generateSecretKey(String password) {
// Convert the password string to a byte array
byte[] passwordBytes = password.getBytes();
{
"questions": [
{
"question": "IIoT stands for ",
"answers": [
"Industrial Internet of Things",
"Internet Internet of Things",
"Intelligence Internet of Things",
"Internal Internet of Things"
],
@webhaikal
webhaikal / php-pools.md
Created November 3, 2021 06:48 — forked from holmberd/php-pools.md
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
#include <iostream>
#include <string>
using namespace std;
const int null = 0;
const string name_array[10] = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" };
struct info_type {
int matric;
std::string name;
@webhaikal
webhaikal / install-mongo.sh
Created December 4, 2017 13:19
Installs MongoDB on Ubuntu 16.04
# !/bin/bash
sudo -i
# Add MongoDB keys
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.2 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.2.list
# Update apt-cache
apt update
###Individual Contributor License Agreement
Thank you for your interest in contributing to open source software projects (“Projects”) made available by Prototype Studios or its affiliates (“Prototype Studios”). This Individual Contributor License Agreement (“Agreement”) sets out the terms governing any source code, object code, bug fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or other works of authorship that you submit or have submitted, in any form and in any manner, to us in respect of any of the Projects (collectively “Contributions”). If you have any questions respecting this Agreement, please contact haikalizz@prototypestd.cu.ma.
You agree that the following terms apply to all of your past, present and future Contributions. Except for the licenses granted in this Agreement, you retain all of your right, title and interest in and to your Contributions.
**Copyright License.** You hereby grant, and agree to grant, to us a non-exclusive, per
<link href="../core-scaffold/core-scaffold.html" rel="import">
<link href="../core-header-panel/core-header-panel.html" rel="import">
<link href="../core-menu/core-menu.html" rel="import">
<link href="../core-item/core-item.html" rel="import">
<link href="../core-icon-button/core-icon-button.html" rel="import">
<link href="../core-toolbar/core-toolbar.html" rel="import">
<link href="../core-menu/core-submenu.html" rel="import">
<polymer-element name="my-element">
<link href="../core-scaffold/core-scaffold.html" rel="import">
<link href="../core-header-panel/core-header-panel.html" rel="import">
<link href="../core-menu/core-menu.html" rel="import">
<link href="../core-item/core-item.html" rel="import">
<link href="../core-icon-button/core-icon-button.html" rel="import">
<link href="../core-toolbar/core-toolbar.html" rel="import">
<link href="../core-menu/core-submenu.html" rel="import">
<polymer-element name="my-element">