Skip to content

Instantly share code, notes, and snippets.

Eugene izimbra

Block or report user

Report or block izimbra

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@izimbra
izimbra / migrate_cucm_phone_records.py
Last active Sep 28, 2016
Converts phone records between different versions of CUCM (tested with 10.5 and 11.0). 'source.csv' - phone records exported from initial CUCM, 'dest.csv' - phone record template exported from the new CUCM (should contain field names). Data from 'source.csv' is copied to 'dest.csv' with deprecated fields being deleted, and new fields left empty.…
View migrate_cucm_phone_records.py
src = open('source.csv', 'r')
dest = open('dest.csv', 'a+')
# 2 arrays to represent CUCM phone records
cucm10 = src.readline().rstrip().split(',')
cucm11 = dest.readline().rstrip().split(',') #map(lambda s: s.rstrip(),
# fields that were added in CUCM 11
new = set(cucm11) - set(cucm10)
@izimbra
izimbra / Network drive access for elevated apps
Last active Sep 28, 2016
Allow access to mapped network drives from elevated apps (Windows Vista and later) #win #uac #network
View Network drive access for elevated apps
reg add «HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System» /v «EnableLinkedConnections» /t REG_DWORD /d 0x00000001 /f
@izimbra
izimbra / Default CMD folder in admin mode
Created May 12, 2016
Set default folder for CMD run in administrator mode #win #cmd
View Default CMD folder in admin mode
REG ADD "HKCU\SOFTWARE\Microsoft\Command Processor" /v AutoRun /t REG_SZ /d "CD /D C:\Path\To\Folder"
@izimbra
izimbra / delayedexp.cmd
Last active Sep 28, 2016
Set variable values inside for-loop.
View delayedexp.cmd
@echo off
:: enable delayed expansion to set variable values inside for-loop
:: usual %VAR% syntax won't work, use !VAR! instead
setlocal EnableDelayedExpansion
for %%A in (%*) do (
set _PARAM=%%A
set _PREFIX=!_PARAM:~0,3!
if /i !_PREFIX!==SearchString (
set LIST_VAR=!LIST_VAR! !_PARAM!
@izimbra
izimbra / Replace first occurrence of a string with sed
Created Oct 26, 2013
Replaces first occurrence of a string in a file using sed. This was tried and worked in OS X 10.9. #osx #shell #sed
View Replace first occurrence of a string with sed
sed '1,/string/ s/string/replacement/' file
@izimbra
izimbra / Replace quoted string in a file with sed
Created Oct 26, 2013
Globally replaces a quoted string (preceded with SOMETHING=) in a file1 using sed. The result is saved in file2. This was tried and worked in OS X 10.9. #sed #osx #shell
View Replace quoted string in a file with sed
sed 's/SOMETHING="[^"]*"/SOMETHING="XXX"/g' file1 > file2
@izimbra
izimbra / Kill processes by name in Win command prompt
Created Aug 20, 2013
Kills all running processes with the specified name. This was tried in Windows 7. #win #batch #wa
View Kill processes by name in Win command prompt
taskkill /F /IM SomeExecutable.exe
@izimbra
izimbra / Toggle OS X desktop icons
Last active Dec 18, 2015
This toggles visibility of desktop icons in OS X. #osx #shell
View Toggle OS X desktop icons
defaults write com.apple.finder CreateDesktop -bool false | true
killall Finder
@izimbra
izimbra / Print HTTP request parameters
Created May 31, 2013
Prints out names and values of parameters of a HTTP request. Useful for using in conditional breakpoints in Eclipse. Since 'false' is returned, this code will only print values, but will not suspend execution. #java #eclipse #http
View Print HTTP request parameters
System.out.println("Request params:");
java.util.Enumeration paramNames = request.getAttributeNames();
while (paramNames.hasMoreElements()) {
java.lang.String name = (java.lang.String) paramNames.nextElement();
java.lang.Object values = request.getAttribute(name);
System.out.println("\t" + name + ": " + values);
}
return false;
@izimbra
izimbra / Recursively list files in shell
Last active Dec 15, 2015
Recursively lists files of specific type in a directory (XML in this case). Unlike `ls' command, `find' only outputs paths of the files, which makes it possible to use them as arguments to other commands. Syntax below was tried in OS X 10.8.3 #shell #osx
View Recursively list files in shell
find $FOLDER | grep -e '.[xml|XML]'
You can’t perform that action at this time.