Skip to content

Instantly share code, notes, and snippets.

View nicdoye's full-sized avatar
🚲
All shall be well, and all shall be well, and all manner of thing shall be well

Nic Doye nicdoye

🚲
All shall be well, and all shall be well, and all manner of thing shall be well
View GitHub Profile
@nicdoye
nicdoye / lgrep.sh
Created October 11, 2016 14:47
Find a string in any file (note may include binaries) in the current folder, but exclude anything under a .git folder
function lgrep {
local str=$1
find . -type f -not -path '*/.git/*' -exec grep -l ${str} {} \;
}
@nicdoye
nicdoye / Reboot.xml
Created September 21, 2016 13:50
Reboot scheduled task for Windows 2008r2. For those with finer grained security, you could use a lower-privileged account than Administrator.
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2016-09-20T11:25:05.3204</Date>
<Author>SOMESERVER\Administrator</Author>
<Description>Simple reboot task</Description>
</RegistrationInfo>
<Triggers>
<TimeTrigger>
<StartBoundary>2016-09-21T06:00:00</StartBoundary>
Verifying that +nicdoye is my blockchain ID. https://onename.com/nicdoye
@nicdoye
nicdoye / incr.sh
Created May 26, 2016 16:16
Incrementing variables on the command line/in scripts for fun and profit
# replace with your variable name
variable=$(echo ${variable} 1 + f | dc)
@nicdoye
nicdoye / rpmlibs.sh
Created April 3, 2016 16:08
Find all RPMs providing libraries to your custom-built software
# Find all RPMs of libraries for binaries in this folder
rpm -qf $(ldd * | grep = | awk '{print $3}' | sort -u | grep ^/) | sort -u
# Similarly, for all .so files under this folder
rpm -qf $(find . -name \*.so -exec ldd {} \; | grep = | awk '{print $3}' | sort -u | grep ^/) | sort -u
@nicdoye
nicdoye / teamForgeWikiDump.txt
Last active March 22, 2016 15:46
Dump TeamForge Wiki to files with markup using TeamForge CLI Client
ctf api CollabNet->getProjectListForUser USERNAME
foreach
do
copy as project
mkdir "$project.title"
tools wiki
foreach
do
copy as wiki
if wikitext
@nicdoye
nicdoye / more-than-a-googol.rb
Created March 2, 2016 23:32
Ever wondered what the maximum size of a numeric (10**1000) in PostgreSQL looks like? Here you go. #pretty
p=1000;l=72;t=3;c=",";n="\n";z=0;w=" ";e=f="";P=p%l;(1..(4*l/t-(2+P+(P/t).floor))).each{|i|f+=w};(1..p).each{|i|q=(p-i+1);print(((i==1)?f.to_s+1.to_s():e)+(((q%t== 0)?c+((q%l==0)?n:e):e)+z.to_s)+((i==p)?n:e))};
@nicdoye
nicdoye / install-node-modules.sh
Created February 29, 2016 17:24
Install and find all the node modules
# Assuming you only require from index.js
# and you use const
# and you use const at the beginning of a line
# and there aren't other things like child_process to filter out
npm install $(egrep ^'const(.*)= require' index.js | egrep -v '/|child_process' | cut -f2 -d\' | xargs)
@nicdoye
nicdoye / list-perl-mods.sh
Created February 21, 2016 18:59
Command liner to list all perl modules installed
PERLDOC="-otext" perldoc perllocal | grep Module | awk '{print $7}'
@nicdoye
nicdoye / DoubleLinkedList.pl
Last active January 31, 2016 18:44
Doubly Linked List in Perl
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
use feature qw /say/;
package Node;
use Moose;