Skip to content

Instantly share code, notes, and snippets.

View dgershman's full-sized avatar
🔒

Danny Gershman dgershman

🔒
View GitHub Profile
@dgershman
dgershman / app.js
Created January 10, 2013 23:17
2nd try at this
var async = require('async');
var obj = [ "apple", "banana", "orange", "pineapple", "kiwi", "watermelon", "grape" ];
function getObj(i, callback) {
setTimeout(function() {
console.log(i)
callback(null);
}, 2000);
}
@dgershman
dgershman / cursorless-looping.sql
Last active December 14, 2015 13:18
Cursorless looping in T-SQL
-- LET'S SAY WE NEED TO LIST THROUGH ALL LAST NAMES AND PERFORM SOME ACTION
-- ON LAST NAMES BEGINNING WITH THE LETTER S
SELECT StaffId, LastName FROM Staff WHERE LastName LIKE 'S%'
-- THIS RETURNS A SET AS SUCH
-- StaffId LastName
-- ======= ========
-- 11 Sherwood
-- 35 Schmidt
-- 41 Sauvé
@dgershman
dgershman / perm-compare.ps1
Created March 7, 2013 19:19
comparing two windows folders permissions
[System.IO.FileInfo] $outputFile = "C:\AclCompareDump.txt"
[System.IO.DirectoryInfo] $searchDir = Read-Host -Prompt "Enter folder path to search"
if ($outputFile.Exists)
{
$outputFile.Delete()
}
if ($searchDir.Exists)
{
@dgershman
dgershman / author-rewrite-commit-history-git.sh
Last active December 14, 2015 16:09
Let's you do a forceful rewrite of the git history swapping orphaned authors.
# ex: ./author-rewrite-commit-history-git.sh "dannygershman@cinchcast.com" "Danny Gershman" "danny.gershman@gmail.com$
oldname=$1
newname=$2
newemail=$3
git filter-branch -f --commit-filter '
if [ "$GIT_COMMITTER_NAME" = "'$oldname'" ];
then
GIT_COMMITTER_NAME="'"$newname"'";
author "Your Name"
description "upstart script for sample-dw-service"
# respawn the job up to 5 times within a 10 second period.
# If the job exceeds these values, it will be stopped and
# marked as failed.
respawn
respawn limit 5 10
# move to this service's working directory
protected void printBanner(String name) {
try {
final String banner = WINDOWS_NEWLINE.matcher(Resources.toString(Resources.getResource("banner.txt"),
Charsets.UTF_8))
.replaceAll("\n")
.replace("\n", String.format("%n"));
LOGGER.info(String.format("Starting {}%n{}"), name, banner);
} catch (IllegalArgumentException | IOException ignored) {
// don't display the banner if there isn't one
LOGGER.info("Starting {}", name);
mvn install:install-file -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1B -Dpackaging=jar -Dfile=jta.jar
mvn install:install-file -DgroupId=microsoft -DartifactId=sqljdbc4 -Dversion=4.0 -Dpackaging=jar -Dfile=sqljdbc.jar
<?xml version="1.0" encoding="US-ASCII"?>
<msml version="1.1">
 <dialogstart target="conn:96460211_47d11d3c_68118bc2-db9d-4f75-914d-cc88861e0294" type="application/moml+xml" name="3">
  <play cvd:barge="true" cvd:cleardb="false">
   <audio uri="file://5011"/>
   <playexit>
    <send target="source" event="app.playdone" namelist="play.amt play.end"/>
   </playexit>
 
#re-sync time for a CentOS VM which was sleeping
/etc/init.d/ntpd stop
ntpdate pool.ntp.org
/etc/init.d/ntpd start
date
#Does an OPTIONS and shows the output
sipsak -d -v -s sip:msml@10.211.55.2