Skip to content

Instantly share code, notes, and snippets.

@Vultour
Vultour / rust-server.rs
Created August 15, 2016 20:02
TCP server in Rust
use std::io::prelude::*;
use std::net::{TcpListener, TcpStream, Shutdown};
use std::sync::mpsc;
use std::io::BufReader;
use std::thread;
use std::str;
fn listen(tx_pipe: mpsc::Sender<u32>){
let listener = TcpListener::bind("127.0.0.1:7777").unwrap();
@Vultour
Vultour / rust-client.rs
Created August 15, 2016 20:05
TCP client in Rust
extern crate rand;
use std::io::prelude::*;
use std::thread;
use std::time::Duration;
use std::net::{TcpStream, Shutdown};
use rand::Rng;
fn thread_exec(id: u32){
@Vultour
Vultour / find.sh
Created September 27, 2016 16:50
Time-specific find
#!/bin/bash
USAGE="Usage: $0 <FOLDER> <ORIGIN-FILE> <TIME-LIMIT> [RECURSIVE?]"
if [ -z $1 ] || [ -z $2 ] || [ -z $3 ]; then
echo $USAGE
exit 1
fi
DIR=$1
#!/bin/bash
TERMCONF="~/.config/xfce4/terminal"
if [ ! -e $TERMCONF/terminalrc ]; then
mkdir -p $TERMCONF
echo "[Configuration]" > $TERMCONF/terminalrc
fi
# Install with:
# virt-install --graphics vnc --name test-1 --memory 2048 --disk machines/test-1.img,size=5 --location http://mirrors.clouvider.net/CentOS/7/os/x86_64/ -x "ks=THIS-KICKSTART_URL"
install
cdrom
lang en_US.UTF-8
keyboard us-acentos
network --device eth0 --bootproto dhcp
# password = password
rootpw --iscrypted $1$nRuazCWk$gUSUI.shpjrhm2fWgrEwY0
firewall --disabled
@Vultour
Vultour / jekyll-trouble-links.sh
Last active October 1, 2016 17:43
Finds links that can cause trouble (relative links)
rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm
yum -y install epel-release https://yum.theforeman.org/releases/1.12/el7/x86_64/foreman-release.rpm
yum -y install foreman-installer
foreman-installer -v
# Remove foreman
yum remove remove foreman foreman-installer foreman-proxy
rm -rf /var/lib/foreman /usr/share/foreman /usr/share/foreman-proxy/logs
rm /etc/httpd/conf.d/foreman.conf
# Remove puppet
yum remove puppet puppetmaster puppet-common puppetmaster-common puppetlabs-release
rm -rf /usr/lib/ruby/vendor_ruby/puppet /usr/share/puppet /var/lib/puppet /etc/puppet
rm /etc/apache2/conf.d/puppet.conf
#!/bin/bash
set -x
set -e
# ==========
# INITIAL SETUP
# ==========
echo "127.0.0.1 labrt.local puppet" >> /etc/hosts