Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@adnan360
adnan360 / https-on-localhost.md
Last active April 22, 2024 13:48
Use HTTPS on Localhost (XAMPP, Windows)

Sometimes some websites require https to work. This can be useful in those cases.

This has been tested with XAMPP (PHP 7.0.8) on Windows 7. Please see the Reference links at the end if in confusion about some step.

STEP 1: Editing Configs

Open:

C:\xampp\php\php.ini
@adnan360
adnan360 / sway-on-void-linux.md
Last active March 5, 2024 05:33
Running Sway (Wayland) on Void Linux (without SystemD)

Running Sway on Void Linux (without SystemD)

elogind is the part of SystemD logind that can run as standalone. So we need it to run Sway without SystemD. To do that we need to build wlroots with elogind option. Then we can install and use Sway as normal from the current repo. There are other ways to achieve this without elogind here. But I tried with the elogind option and I was successful.

UPDATE: I tried again on a fresh install. The elogind option is set by default on the repo version. So you can skip the xbps-src command below and continue. wlroots should install as a dependency of sway if you follow the later commands.

git clone git://github.com/void-linux/void-packages.git
cd void-packages
./xbps-src binary-bootstrap
@adnan360
adnan360 / lampp-on-debian.md
Last active February 23, 2024 04:30
How to Install LAMPP Stack on Debian/Ubuntu [Experimental]

How to Install LAMPP Stack on Debian/Ubuntu [Experimental]

Ubuntu is based on Debian so it should apply to Ubuntu as well. I have tested this on latest Debian Testing (on SparkyLinux). I usually use WordPress and CakePHP on my localhost so I included instructions at the end to make them work perfectly.

Warning: This config is not designed with security in mind, only for convenience of desktop users. If you are setting up for server, please refer to proper manuals.

Note: This config is experimental. There might be better way to do some aspects. But it does work for my specific needs so I made it available. Please use carefully.

Step 1: Install stuff

@adnan360
adnan360 / install-weston-void-linux.md
Last active October 13, 2023 22:58
Basic Guide on how to install and use Weston (Wayland) on Void Linux (without SystemD)

How to Install and Use Weston (Wayland) on Void Linux (without SystemD)

sudo xbps-install weston
sudo usermod -a -G weston-launch `whoami`

Reboot to update the group assignment.

Now we can prepare the config. Let's create the file:

@adnan360
adnan360 / power.sh
Created August 8, 2018 11:43
Simple script to create a selection menu for shutdown, reboot etc. based on rofi in dmenu mode
#!/bin/bash
# Simple script to handle a DIY shutdown menu. When run you should see a bunch of options (shutdown, reboot etc.)
#
# Requirements:
# - rofi
# - systemd, but you can replace the commands for OpenRC or anything else
#
# Instructions:
# - Save this file as power.sh or anything
@adnan360
adnan360 / write-bangla-with-unijoy-and-fcitx-in-kde.md
Created September 16, 2017 08:01
How to Write Bangla with Unijoy Layout using Fcitx in KDE Plasma 5

How to Write Bangla with Unijoy Layout using Fcitx in KDE Plasma 5

This has been tested on Arch Linux 2017 (Linux Kernel 4.12.12-1-ARCH) with KDE Plasma 5.10 installed, with libreoffice-fresh version 5.4.1.2.0 and other KDE apps.

Install the necessary pacakges:

sudo pacman -S fcitx fcitx-qt4 fcitx-qt5 m17n-db fcitx-m17n fcitx-configtool 
@adnan360
adnan360 / functions.php_snip
Created January 27, 2017 03:15
Woocommerce Subscriptions: get all subscribed products for a subscriber (find if a product is subscribed)
<?php
function has_an_active_subscriber( $product_id = null ){
// Empty array to store ALL existing Subscription PRODUCTS
$products_arr = array();
$products_subscr = get_posts( array(
'numberposts' => -1,
'post_status' => 'publish',
@adnan360
adnan360 / install-linux-libre-on-fedora.md
Created August 19, 2019 06:49
How I installed Linux Libre kernel on Fedora 30

How to install Linux Libre in Fedora

Fedora has the Linux kernel. This instruction is to install Linux Libre kernel which is a version of the Linux kernel with closed source binary blobs removed. This results in a Free-er system which respects your 4 essential freedoms. On Fedora, the linux libre kernel has the name "Freed-ora freedom".

I tried this on a Fedora 30 install.

WARNING: Although this gives you a libre kernel, it is possible that all components of your hardware does not work without binary blobs (e.g. wifi card, bluetooth). In that case those components will not work after installation. Please do not apply this on a production install before testing thoroughly and for prolonged period of time on a test install. Use these instructions at your own risk. Backing up is also recommended.

sudo -s
@adnan360
adnan360 / lamp-on-void-linux.md
Last active June 10, 2023 11:13
Instructions on how to install LAMP on Void Linux for easier PHP development

How to install LAMP in Void Linux

To install LAMP (Linux, Apache, MySQL/MariaDB, PHP) on Void Linux, follow these steps below.

NOTE: This has been prepared for ease of use in mind, not security. Please do not use these instructions to setup on a public server environment. Use other proper manuals instead.

Install the things we need:

@adnan360
adnan360 / WP-plugin-settings-sample.php
Created September 28, 2016 07:04
Wordpress plugin with settings options sample code
<?php
// Example # 2 from
// https://codex.wordpress.org/Creating_Options_Pages
class MySettingsPage
{
/**
* Holds the values to be used in the fields callbacks
*/
private $options;