Skip to content

Instantly share code, notes, and snippets.

@nickabal
nickabal / gist:3c091446566d96d3619fd8b67ea9ac47
Created September 10, 2016 21:11
given string of book count the words using php
<?php
$book = 'Some Text Is Here Text Is Text Text characters';
$book_words = explode(" ", $book);
$counted_words = array();
foreach ( $book_words as $word ) {
if ( array_key_exists($word, $counted_words) ) {
$counted_words[$word]++;
rsync single directory across two disks. rsync stops when first disk is full, then run rsync -n to see whats remaining, pipe to rsync again to finish on another disk
rsync -av /storage/ /mnt/disk1/
... of of space ...
rsync -av -n /storage/ /mnt/disk1/ | while read LINE; do rsync -av --progress "$LINE" "/mnt/disk2/$LINE"; done
@nickabal
nickabal / gist:0a3faaa45b76a53bfad76a748e27b58f
Created April 11, 2016 17:30
Set brightness via radeon_bl0 when redshift status changes
#!/bin/bash
# Set brightness via radeon_bl0 when redshift status changes (amdgpu,radeon)
### Set brihtness via xbrightness when redshift status changes
# Set brightness values for each status.
# Range from 1 to 255 is valid
brightness_day="255"
brightness_transition="120"
# Pair of script for encrypt and decrypt directories using AES
#encrypt.sh
#!/bin/bash
wd=`pwd`;
if [ -z "$1" ]; then echo "./encrypt.sh <foldername>"; exit 1; fi
indir=$1
out=$wd/
#!/usr/bin/env bash
# Simple cpu test in bash
# Number of threads
numthreads=64 #Changing this will affect results
#Addition
function count() {
#!/usr/bin/env bash
# Software entropy generator
seed=1024
function output() {
base64=`echo "obase=64;$1" | bc | cut -c8-9`
case $base64 in
00)letter=a;;