This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var logger = function(event, log){ | |
switch(event) { | |
case 'info': | |
break; | |
case 'log': | |
console.log(log); | |
break; | |
case 'warn': | |
console.warn(log); | |
break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update cwd_group set group_name='<new_group_name>', lower_group_name='<new_group_name>' where lower_group_name='<old_group_name>'; | |
update cwd_membership set parent_name='<new_group_name>', lower_parent_name='<new_group_name>' where lower_parent_name='<old_group_name>'; | |
update sta_project_permission set group_name='<new_group_name>' where group_name='<old_group_name>'; | |
update sta_repo_permission set group_name='<new_group_name>' where group_name='<old_group_name>'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var p = require('path'); | |
var f = __dirname.substring(0, __dirname.lastIndexOf('node_modules') + 'node_modules'.length + p.sep.length); | |
var l = p.relative(f, __dirname); | |
console.log(l.split(p.sep)[0]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for branch in $(git rev-list --all) | |
do | |
if (git ls-tree -r --name-only $branch | grep --quiet "FireFox") | |
then | |
echo $branch $(git branch --contains $branch) | |
fi | |
done | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Unmatch | |
Get-ADUser -filter * -Properties SamAccountName, DisplayName, EmailAddress | select SamAccountName, DisplayName, EmailAddress | Where-Object {-not ($_.EmailAddress -like $_.SamAccountName + '[email protected]')} | |
# Match | |
Get-ADUser -filter * -Properties SamAccountName, DisplayName, EmailAddress | select SamAccountName, DisplayName, EmailAddress | Where-Object {$_.EmailAddress -like $_.SamAccountName + '[email protected]'} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -maxdepth 5 -name .git -type d | xargs -i bash -c 'p={}; echo ${p:0:-5}; git -C "{}" remote get-url origin; echo ""' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# It's pretty slow, but works | |
Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -match "Java" -and $_.Vendor -match "Oracle" } | ForEach-Object { $_.Uninstall() } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var fsp = { | |
stat: function(file) { | |
return new Promise(function(resolve, reject) { | |
fs.stat(file, function(err, stats) { | |
if (err) return reject(err); | |
return resolve(stats); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP PROCEDURE IF EXISTS loopTables; | |
DELIMITER // | |
CREATE PROCEDURE `loopTables` () | |
BEGIN | |
DECLARE curr_table VARCHAR(200); | |
DECLARE cursor_tables CURSOR FOR select table_name from information_schema.tables where table_schema = (SELECT DATABASE()); | |
OPEN cursor_tables; | |
grant_loop: LOOP | |
FETCH cursor_tables INTO curr_table; | |
-- do something |