Skip to content

Instantly share code, notes, and snippets.

View kaloprominat's full-sized avatar

Pavel Kondratev kaloprominat

View GitHub Profile
@kaloprominat
kaloprominat / mac os x: bash sign unsign configuration profile
Last active May 30, 2024 07:58
mac os x: bash sign unsign configuration profile
/usr/bin/security cms -S -N "Mac Developer Application" -i /path/to/your.mobileconfig -o /path/to/your/signed/output.mobileconfig
/usr/bin/security cms -D -i 123-3.mobileconfig | xmllint --format -
@kaloprominat
kaloprominat / bash git add push tags
Created November 24, 2015 10:02
bash git add push tags
git tag -a 1.2.3 -m 'my version 1.2.3'
git push origin 1.2.3
git push origin --tags
@kaloprominat
kaloprominat / mysql: skip replication error
Created August 31, 2015 12:48
mysql: skip replication error
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE;
@kaloprominat
kaloprominat / os x: bash determine which user active logged
Created May 20, 2015 13:09
os x: bash determine which user active logged
stat -f '%Su' /dev/console
@kaloprominat
kaloprominat / openssl verify remote host certificate
Created April 29, 2015 14:58
openssl verify remote host certificate
openssl s_client -connect servername:443
@kaloprominat
kaloprominat / xcode objective-c singleton instance gcd example
Created March 20, 2015 21:53
xcode objective-c singleton instance gcd example
+ (Singleton *)sharedSingleton
{
static Singleton *sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[Singleton alloc] init];
});
return sharedInstance;
@kaloprominat
kaloprominat / xcode objective-c GCD dispatch group wait example
Last active August 5, 2023 10:50
xcode objective-c GCD dispatch group wait example
//first
dispatch_async(queue, ^{
dispatch_group_t group1 = dispatch_group_create();
// Tasks goes here
for (NSInteger i = 0; i < 3; i++) {
@kaloprominat
kaloprominat / gist:650621f8a7524a6620b3
Created March 11, 2015 22:11
html css strech div to fit all vertical space
Here is the solution I finally came up with when using a div as a container for a dynamic background.
Remove the z-index for non-background uses.
Remove left or right for a full height column.
Remove top or bottom for a full width row.
EDIT 1: CSS below has been edited because it did not show correctly in FF and Chrome. moved position:relative to be on the HTML and set the body to height:100% instead of min-height:100%.
EDIT 2: Added extra comments to CSS. Added some more instructions above.
The CSS:
@kaloprominat
kaloprominat / os x: python get currently logged user
Last active March 13, 2022 10:14
os x: python get currently logged user
#python and system configuration framework
loggedInUser=`python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");'`
# dev console owner (_mbsetup user stable)
stat -f '%Su' /dev/console
# scutil
echo "show State:/Users/ConsoleUser" | scutil
# loginwindow plist (last means last, fails with multiuser sessions)
@kaloprominat
kaloprominat / os x: spotlight suggestions disable plist
Created November 10, 2014 11:53
os x: spotlight suggestions disable plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadContent</key>
<dict>
<key>com.apple.Spotlight</key>