Skip to content

Instantly share code, notes, and snippets.

@lolgear
lolgear / git_single_file_revision_search.sh
Created November 23, 2016 15:44
Search Podfile.lock for specific pod commit updates.
# $file = path to file;
# $name = ( name to search (actually, it is a regex) )
# EncryptedCoreData:
# - :commit: 5044489e622143d6efdb69fbbc383748618b5fe4
# + :commit: 4ca0977e9e0b610e6813886276bb7bbd9406335f
#
#
# Pod revision.
git log -p -- FILE | perl -lne '$name = 'PODNAM'; (/^\s+$name[\w-]*:\s*$/ .. /^\+\s+:commit:/) and print'
@lolgear
lolgear / project_find_and_link.pl
Created September 9, 2016 12:46
when you have too many xcworkspaces in your project, you could gather them in a directory and put it in dock
ls ./AppIcon.appiconset/*.png | perl -MFile::Basename -ne 'chomp; ($b, $d, $f) = fileparse($_, qr/\.[^.]*/); $s = qx(convert -channel G -separate ${_} ./AppIconPublicBeta.appiconset/${b}.png); print "$s"; print "\n";'
http://www.imagemagick.org/Usage/color_basics/#separate
@lolgear
lolgear / build_osx_framework_without_pin_in_ass.pl
Last active May 3, 2016 17:00
this is very helpful script, which can helps me and you to build Xcode libraries into frameworks ;) (NB: It will need some fixes about framework Resources)
#----- Common functions -----#
sub say {
for (@_){print; print "\n";}
}
sub qxx{
my $what = shift;
say qq(I will do $what);
my $str = qx($what);
if ($?){
die "I fall down on < $what >\n! because of < $? >";
@lolgear
lolgear / clear_script.pl
Created June 10, 2013 16:07
This script clear data, which were placed in directory .../DerivedData - directory of compiled Xcode projects
#!/usr/bin/perl
my $pathToCacheDirectory = qq(~/Library/Developer/Xcode/DerivedData/);
sub TaskToDo{
my ($refToArgv)=@_;
die "can't work with too much parameters" unless(scalar(@$refToArgv)==1);
my $what = shift @$refToArgv;
my $time = 30; #wait 30 seconds in each iteration
my $workRef = sub{
print "i will delete: ";
@lolgear
lolgear / gist_parrot_gsoc_2013.md
Last active December 17, 2015 13:09
GNU Scientific Library (GSL) bindings for Parrot

Abstract

This project can be thought of as porting a subset Math::GSL to Parrot.

Details

There are many GSL subsystems, so this project should focus on binding to Special Function, Random Distributions and Cumulative Distribution Functions (CDFs), which have the simplest function signatures. Deliverables will be the implementation, examples, docs and tests.

Schedule

May 27- June 16:

This period I will spent on read documentation to parrot, also see examples of GSL library.

@lolgear
lolgear / reset_settings_and_content_ios_simulator
Created December 13, 2012 10:59
reset settings and content ios simulator script
#!/usr/bin/perl
sub before_space{
for(@_){
s/[ ]/\\ /g;
}
return @_;
}
my $path = $ENV{HOME}.'/';
$path .= q(Library/Application Support/iPhone Simulator);
@lolgear
lolgear / C fgets stop at eof and newline
Created December 5, 2012 04:33
fgets normal input from stdin with stop at newline
char* inputStringWithStopChar(char stopChar){
int n = 5;
int size = n;
char* const_str = (char*)malloc(n*sizeof(char));
char* substring = (char*)malloc((n+n)*sizeof(char));
char*p;
while((fgets(const_str,n,stdin)!=NULL)&&(strchr(const_str,stopChar)==NULL)){
strcat(substring,const_str);
size += n;
substring = (char*)realloc(substring,size*sizeof(char));
class A
def relativePath(path)
self.relativePath(path,self.path)
end
def self.relativePath(path,to_path)
Pathname.new(path).relative_path_from(Pathname.new(to_path))
end
end
class A
def needToCallAsInstanceAndClass# or no arguments
self.class.needToCallAsInstanceAndClass(self.getArgs)
end
def self.needToCallAsInstanceAndClass(*args)
# wowowow
# implementation here
end
end