Skip to content

Instantly share code, notes, and snippets.

@hollowbash
hollowbash / remove-all-from-docker.sh
Created September 22, 2021 13:01 — forked from beeman/remove-all-from-docker.sh
Remove all from Docker
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
@hollowbash
hollowbash / Работа с классом PDO
Created September 17, 2021 17:42 — forked from trs2015/Работа с классом PDO
Основные команды и сниппеты при использовании PDO
<?php
// Основные команды и сниппеты при использовании PDO
//Соединение с БД
$db = new PDO('mysql:host=localhost;dbname=mini-site', 'root', '');
// 1. Выбор данных из БД без защиты
$username = 'Joker';
$password = '555';
@hollowbash
hollowbash / gist:b03ef90ee1b8b8d9cb75e61bc95d6a1e
Created September 17, 2021 14:05 — forked from VitaliiTsilnyk/gist:2398764
Самый простой пример PDO
<?php
// Подключаемся к бд. первый параметр - линк к бд вида "драйвер:host=хост;port=порт;dbname=имя_бд
// Второй и третий параметры - логин и пас соответственно
$db = new PDO(
"mysql:host=localhost;port=3306;dbname=tmp_db",
"root",
"*************"
);
@hollowbash
hollowbash / csv_stream.php
Created August 9, 2021 15:24 — forked from damncabbage/csv_stream.php
CSV via File Handle
<?php
class CSVStream {
/**
* List of available source fields.
*
* @var array
*/
protected $fields = array();
@hollowbash
hollowbash / scp-speed-test.sh
Created June 9, 2021 12:46 — forked from mohanraj-r/scp-speed-test.sh
[speed test] Test ssh connection speed
#!/bin/bash
# scp-speed-test.sh
# Author: Alec Jacobson alecjacobsonATgmailDOTcom
# http://www.alecjacobson.com/weblog/?p=635
#
# Test ssh connection speed by uploading and then downloading a 10000kB test
# file (optionally user-specified size)
#
# Usage:
# ./scp-speed-test.sh user@hostname [test file size in kBs]
@hollowbash
hollowbash / 1_freespace.sh
Created March 5, 2021 23:51 — forked from bitstarr/1_freespace.sh
[Compress Virtual Mashine Size] Reduce the size of the .ova or the virtual disk of a virtual mashine #Linux #CLI
# Fill all empty space with zero
# @see https://seshagiriprabhu.wordpress.com/2012/11/22/shrink-virtualbox-image-and-export-it-into-and-ovaovf-file-format/
sudo dd if=/dev/zero of=/bigemptyfile
sudo rm -rf /bigemptyfile
# If the free space on the guest OS is not much left, you can use the following alternative:
# cat /dev/zero > zero.fill;sync;sleep 1;sync;rm -f zero.fill
@hollowbash
hollowbash / archlinux_installation_ux370u_full_disk_encrypted.sh
Created February 26, 2021 22:57 — forked from mathben/archlinux_installation_ux370u_full_disk_encrypted.sh
BASH - Installation Arch Linux on Asus ZenBook UX370U - Full disk single boot
#!/usr/bin/env bash
# French Guide : https://github.com/FredBezies/arch-tuto-installation
# Install ARCH Linux with UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M status=progress && sync # on linux