Skip to content

Instantly share code, notes, and snippets.

View UltimateByte's full-sized avatar

UltimateByte UltimateByte

View GitHub Profile
@UltimateByte
UltimateByte / debian_basic_packages
Last active January 16, 2017 00:04
First things to do in debian
apt-get update && apt-get upgrade
dpkg --add-architecture i386 && apt-get update
apt-get install nano wget zip unzip bzip2 linux-kernel-headers tmux ca-certificates curl locales
# sources in /etc/apt/sources.list
# First off, you'd better use SFTP that comes with the SSH protocol on default port 22.
# > Nothing to configure to get it working as long as you got an SSH server.
# If you wish to install an FTP server anyways, then:
# Uninstall any other FTP
apt-get remove --purge your_previous_ftp_server
# Update your package list and programs and install proftpd
apt-get update && apt-get upgrade
apt-get install proftpd
@UltimateByte
UltimateByte / 1) debian_change_hostname
Last active June 3, 2019 23:22
How to create a proper debian LAMP server
# Hostname
hostname
hostname -f
nano /etc/hostname
nano /etc/hosts
shutdown -r now
hostname
hostname -f
# According to my tutorial, make sure you got a dedicated user for the website
adduser username
# Getting Wordpress
cd /home/username/public_html
wget https://wordpress.org/latest.tar.gz
tar -zxvf latest.tar.gz
rm latest.tar.gz
mv wordpress/* .
rm -R wordpress
# Permissions
Change permissions for user, groups, and others on files and directories.
## Command
chmod
## Syntax
chmod -destination+-permissions /path/to/dir/or/file
### Recursive argument
# This is targetted towards people using a user for each website.
# Give back its own files to your user
chown -R user:user ~user/public_html
# Copy user permissions to group permissions
chmod -R g=u ~user/public_html
# Disallow other users from everything on your files
chmod -R o-rwx ~user/public_html
@UltimateByte
UltimateByte / filesgen.sh
Created April 27, 2017 14:48
Create many files
#!/bin/bash
# Settings
subdir="manyiles"
echo "Starting"
echo "How many files do you wanna generate ?"
read -r amount
@UltimateByte
UltimateByte / Swap cheatsheet
Created April 24, 2018 19:00
Manage Linux swap
# Swap strengh (between 0-100) > Lowest value == less swap
sysctl vm.swappiness=X
# Permanently store this value
/etc/sysctl.conf
# Disable Swap
swapoff -a
# Enable Swap
@UltimateByte
UltimateByte / Debian Basics
Created June 3, 2019 23:13
Debian first things after install
# Update the system
apt update && apt upgrade
# Add 32 bit architecture support (game servers)
dpkg --add-architecture i386 && apt update
# Install basic packages
apt install nano wget zip unzip bzip2 linux-kernel-headers tmux ca-certificates curl locales
# Reminder: sources for apt are in: /etc/apt/sources.list
# Chaning hostname
hostname #insernamehere
@UltimateByte
UltimateByte / unserialize.php
Created October 3, 2023 20:47
Unserialize Data (WordPress)
<?php
// Your serialized data
$option_value = 'a:100:[...]';
$data = unserialize($option_value);
// Data to replace directly within variable
$data['footer_text'] = '<a href="https://www.lrob.fr">Webmaster lrob.fr</a>';
// We serilize data back