Skip to content

Instantly share code, notes, and snippets.

@liuha
liuha / custom-ubuntu-22.04.sh
Created June 27, 2022 12:56 — forked from dmanning21h/custom-ubuntu-20.04.sh
Customization script for fresh install of Ubuntu 22.04
# Update System
sudo apt update && sudo apt upgrade -y
# Curl
sudo apt-get install wget gpg
sudo apt install apt-transport-https curl
# Clear Favorites
gsettings set org.gnome.shell favorite-apps "['']"
@liuha
liuha / Documentation.md
Created March 5, 2021 14:53 — forked from KartikTalwar/Documentation.md
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@liuha
liuha / sed cheatsheet
Created September 11, 2019 14:46 — forked from ssstonebraker/sed cheatsheet
Sed Cheatsheet
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@liuha
liuha / README.md
Created May 8, 2019 15:41 — forked from elsonrodriguez/README.md
Ceph Ansible Quickstart Guide

Quick and Dirty Ceph Cluster

This is a bare-bones guide on how to setup a Ceph cluster using ceph-ansible

This guide assumes:

  • Ansible is installed on your local machine
  • Eight Centos 7.2 nodes are provisioned and formatted with XFS
  • You have ssh and sudo access to your nodes

Ansible Setup

# basic pfctl control
# ==
# Related: http://www.OpenBSD.org
# Last update: Tue Dec 28, 2004
# ==
# Note:
# this document is only provided as a basic overview
# for some common pfctl commands and is by no means
# a replacement for the pfctl and pf manual pages.
/* Bootstrap 4 - https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css */
.active
.alert
.alert-danger
.alert-dark
.alert-dismissible
.alert-heading
.alert-info
.alert-light
@liuha
liuha / mariadb.yml
Created December 11, 2017 16:40 — forked from vovanmix/mariadb.yml
Install mariadb via ansible on centOS
--- # Install mariadb via ansible on centOS
- hosts: appserver
user: test
sudo: yes
vars:
mysql_root_password: passwd
tasks:
- name: Install MYSQL
yum:
name: mariadb-server #debian: mysql-server
@liuha
liuha / dirtywebserver.ps1
Created December 2, 2016 21:11 — forked from obscuresec/dirtywebserver.ps1
Dirty PowerShell Webserver
$Hso = New-Object Net.HttpListener
$Hso.Prefixes.Add("http://+:8000/")
$Hso.Start()
While ($Hso.IsListening) {
$HC = $Hso.GetContext()
$HRes = $HC.Response
$HRes.Headers.Add("Content-Type","text/plain")
$Buf = [Text.Encoding]::UTF8.GetBytes((GC (Join-Path $Pwd ($HC.Request).RawUrl)))
$HRes.ContentLength64 = $Buf.Length
$HRes.OutputStream.Write($Buf,0,$Buf.Length)
@liuha
liuha / web-servers.md
Created December 1, 2016 21:08 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
<?php
/**
* Нахождение кратчайшего пути между двумя произвольными вершинами в графе
* http://ru.wikipedia.org/wiki/Алгоритм_Дейкстры
*/
class Dijkstra
{
private $_graph = array();
private $_nodes = array();