Skip to content

Instantly share code, notes, and snippets.

@derak
derak / gist:7936673
Created December 12, 2013 22:27
Remove all commits of a file from a repo
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch some_file.py' --prune-empty --tag-name-filter cat -- --all
@derak
derak / Jenkins AutoPkg build command
Last active June 20, 2016 20:52
AutoPkg build that pipes output to a log file. Build fails if nothing is added to munki.
#!/bin/sh
/usr/local/bin/autopkg run -v ${JOB_NAME}.munki MakeCatalogs.munki 2>&1 | tee /Users/Shared/Jenkins/tmp/${JOB_NAME}.log
RESULT=`grep rebuilt /Users/Shared/Jenkins/tmp/${JOB_NAME}.log`
if [ -n "$RESULT" ]; then
echo "${JOB_NAME} added to Munki repository. Build successful."
exit 0
else
echo "Nothing added to munki. Failing the build even though all is well."
exit 1
@derak
derak / ldap_search_users
Created December 2, 2014 21:53
LDAP Search Users
ldapsearch -LLL -x -h ad.company.com -D "uid=username,ou=Users,ou=MyGroup,dc=AD,dc=company,dc=com" -b "ou=MyGroup,dc=AD,dc=company,dc=com" -W
@derak
derak / Windows Shit
Last active August 29, 2015 14:14
shit for windows
# Open Active Directory Module for Windows PowerShell in Administrative Tools and type the following command.
Get-ADGroupMember -Identity GROUP-A | Add-ADPrincipalGroupMembership -MemberOf GROUP-B
# Get-ADGroupMember gets all the members of GROUP-A and pipes into Add-ADPrincipalGroupMembership cmdlet that added the incoming members to GROUP-B.
# count members
(Get-ADGroupMember -Identity “GROUPNAME”).count
# print group members
@derak
derak / setup_autopkg
Created January 30, 2015 00:35
setup_autopkg
deploy:Desktop jenkins$ cat setup_autopkg.sh
#!/bin/bash
defaults write com.github.autopkg GIT_PATH /usr/bin/git
defaults write com.github.autopkg MUNKI_REPO /Volumes/deploy/munki_repo
autopkg repo-add https://github.com/autopkg/recipes.git
autopkg repo-add https://github.com/autopkg/derak-recipes.git
defaults write com.github.autopkg CACHE_DIR ~/Library/AutoPkg/Cache
@derak
derak / make iso on mac
Created April 17, 2015 21:46
make iso image on mac
hdiutil makehybrid -o ~/Desktop/image.iso ~/path/to/folder/to/be/converted -iso -joliet