Skip to content

Instantly share code, notes, and snippets.

View random-robbie's full-sized avatar
💭
Hacking!

Robbie random-robbie

💭
Hacking!
View GitHub Profile
@random-robbie
random-robbie / Bash tweet
Created September 8, 2013 07:14
Tweet From Bash
#! /bin/bash
# tweet
#
# This script sends tweets
# Use:
# tweet "String to be tweeted"
# Special characters may not be used if your string is not delimited by quotes
#
# Author: San Bergmans
#!/bin/bash
HOST=$(hostname)
function install_postfix() {
echo | sudo debconf-set-selections <<__EOF
postfix postfix/root_address string
postfix postfix/rfc1035_violation boolean false
postfix postfix/mydomain_warning boolean
postfix postfix/mynetworks string 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
@random-robbie
random-robbie / Remove Zero Bytes
Created October 1, 2014 10:09
PHP - Remove 0kb files from folder and put text file with removed file's in.
<?php
$fol = "/var/www/zerobytes/test/";
if ($handle = opendir($fol)) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != ".." && $entry != "removed.txt" && $entry != is_dir("".$fol."".$entry."")) {
//Check filesize
if(filesize("".$fol."".$entry."") < '1000'){
$myfile = fopen("".$fol."removed.txt", "a") or die("Unable to open file!");
$txt = "$entry\r\n";
@random-robbie
random-robbie / gist:4cec8056815362550726
Created October 8, 2014 14:35
Scan all folders and sub-directories and print to output file.
import os, time, glob, fnmatch
maindir = "THE FOLDER YOU WISH TO SCAN"
def scanfolder():
os.chdir(maindir)
for name in glob.glob('*/*.pdf'):
fo = open("Output.txt", "wb")
print name
fo.write(name + "\n")
sudo apt-get install hostapd udhcpd -y
nano /etc/udhcpd.conf
insert in to:
start 10.0.2.1 # This is the range of IPs that the hostspot will give to client devices.
end 10.0.2.100
interface wlan0
remaining yes
#!/bin/bash
wget https://gist.githubusercontent.com/txt3rob/4cc88f810969f75dcdce/raw/758f5e04b21042b3c698bc5affb9101e7fd861e3/gistfile1.txt -O shairport.sh
chmod 777 shairport.sh
sudo shairport.sh
#!/bin/bash
################################################
#
# Backup all MySQL databases in separate files and compress those and also rsync a directory so all scripts are backed up
# Furthermore the script will create a folder with the current time stamp
# @author: Per Lasse Baasch (http://skycube.net) - Original Author
# @author: Robert Wiggins - Altered to include rysnc and removed timestamp from mysql-backup file names
# NOTE: MySQL and gzip installed on the system
# and you will need write permissions in the directory where you executing this script
# You will also need to run ssh-copy-id to the server you are backing up so that you do not need a password to do the backup.
@random-robbie
random-robbie / gist:b96406721a7f6bd2ed84
Created June 17, 2015 09:31
Convert UTC to GMT Date PHP
$date = "2015-05-31";
$d=strtotime($date);
$newdate = date('d-m-Y',$d);
@random-robbie
random-robbie / PDOfailover.php
Created June 18, 2015 12:38
Load Balance & Fail Over PDO mysql Connection
<?php
$ran = rand(1,10);
if ($ran < 5) {
$host = '10.0.0.2';
$backup = '10.0.0.3:3306';
} else {
$host = '10.0.0.3:3306';
$backup = '10.0.0.2:3306';
}
@random-robbie
random-robbie / grab_pic_twitter_com.php
Last active August 29, 2015 14:23
grab pic.twitter.com image
<?php
// Defining the basic scraping function
function scrape_between($data, $start, $end){
$data = stristr($data, $start); // Stripping all data from before $start
$data = substr($data, strlen($start)); // Stripping $start
$stop = stripos($data, $end); // Getting the position of the $end of the data to scrape
$data = substr($data, 0, $stop); // Stripping all data from after and including the $end of the data to scrape
return $data; // Returning the scraped data from the function
}