Skip to content

Instantly share code, notes, and snippets.

View dive's full-sized avatar
👹

Artem Loenko dive

👹
View GitHub Profile
@dive
dive / skype_history.sh
Created January 29, 2012 20:08
open Skype DB with history and remove some items (Mac OS)
# shutdown Skype
# Skype username - it's a login at Skype
# Mac username - it's a short username of Mac OS X (ex.: dive)
# <...> should be entered without brackets <>
#copy this one, paste to Terminal.app and hit Enter
sqlite3 "$HOME/Library/Application Support/Skype/<your_skype_username>/main.db"
#then copy this one, paste to Terminal.app where sqlite3 running and hit Enter
delete from Messages where dialog_partner = '<delete_history_of_conversation_with_particurarly_username>';
@dive
dive / gist:1952734
Created March 1, 2012 20:05
lepra stuff diff
--- 123.html
+++ (clipboard)
@@ -183,7 +183,7 @@
.main {
-
+ background:url(/i/login/field.jpg) 50% 64%;
@dive
dive / gist:1979003
Created March 5, 2012 16:02
coredata with dispatch
- (void)saveArrayOfImages:(NSMutableArray *)arrayOfImages
{
for (UIImage *imageObject in arrayOfImages)
{
dispatch_queue_t backgroundQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);
dispatch_async(backgroundQueue, ^{
NSManagedObjectContext *context = [appDelegate managedObjectContext];
NSData *dataFromImage = UIImagePNGRepresentation(imageObject);
@dive
dive / gist:2920023
Created June 12, 2012 20:46
iOS 5 cyrillic domain byg
NSString *string = [NSString stringWithUTF8String: @"http://президент.рф"];
NSURL *url = [NSURL URLWithString:[string stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
After this operations I check NSURL with:
[[UIApplication sharedApplication] canOpenURL:url]
canOpenURL return true. Then I open this NSURL at build-in browser Safari,
Safari told me that this page cannot be opened
(encoded URL seems like: http://xn--d1abbgf6aiiy.xn--p1ai),
after this I just press Refresh at browser without any additional actions
@dive
dive / redefine_spotlight.scpt
Created June 16, 2012 16:27
Redefine Spotlight Privacy settings
set volume_path_to_disable to POSIX path of "/Volumes/Macintosh HD/"
set volume_path_to_enable to POSIX path of "/Volumes/OS X Mountain Lion"
set command to "mdutil -d " & quoted form of volume_path_to_disable & "&&" & "mdutil -i on " & quoted form of volume_path_to_enable
do shell script command with administrator privileges
@dive
dive / gist:2977600
Created June 23, 2012 08:49
instance variables (interface declaration)
/* 1 - непосредственно в интерфейсе класса (*.h) */
@interface IVExample : NSObject {
NSString *string;
int number;
}
@end
@dive
dive / gist:2977631
Created June 23, 2012 08:59
instance variables (extension declaration)
/* 2 - в class extension */
@interface IVExample () {
NSString *string;
int number;
}
@end
@dive
dive / gist:2977633
Created June 23, 2012 08:59
instance variables (declare in implementation)
/* 3 - в начале имплементации класса (*.m) */
@implementation IVExample () {
NSString *string;
int number;
}
...
@end
@dive
dive / gist:3070807
Created July 8, 2012 12:48
Terminal.app tips and tricks
# navigation
# ctrl + A - moves to the start of the line
# ctrl + E - moves to the end of the line
# ctrl + B - move back on character
# ctrl + F - move forward one character
# esc + B - move back one word
# esc + F - move forward one word
# alt + <-/->
# ctrl + U - delete from the cursor to the beginning of the line
# ctrl + K - delete from the cursor to the end of the line
@dive
dive / fix_skype_conversation_icons_retina.sh
Created August 4, 2012 19:30
Fix the size of avatars in the Skype conversation screen for Retina Macbook Pro screen
#!/bin/bash
# by Artyom Loenko aka dive (artyom.loenko@mac.com)
# Usage:
# - download this script
# - open Terminal.app
# - goto to Folder where script downloaded
# - run 'chmod +x fix_skype_conversation_icons_retina.sh'
# - then run './fix_skype_conversation_icons_retina.sh'