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
| # install AFP | |
| # from: http://ubuntuforums.org/showthread.php?t=410274 | |
| mkdir -p ~/src/netatalk | |
| cd ~/src/netatalk | |
| sudo aptitude install devscripts cracklib2-dev dpkg-dev libssl-dev | |
| apt-get source netatalk | |
| sudo apt-get build-dep netatalk | |
| # this folder name may change depending on the version of netatalk | |
| cd netatalk-2.0.5 |
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
| ### This file is an example password file for svnserve. | |
| ### Its format is similar to that of svnserve.conf. As shown in the | |
| ### example below it contains one section labelled [users]. | |
| ### The name and password for each user follow, one account per line. | |
| [users] | |
| #username=password |
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
| #!/usr/bin/env ruby | |
| # Usage: gemspec [-s] GEMNAME | |
| # | |
| # Prints a basic gemspec for GEMNAME based on your git-config info. | |
| # If -s is passed, saves it as a GEMNAME.gemspec in the current | |
| # directory. Otherwise prints to standard output. | |
| # | |
| # Once you check this gemspec into your project, releasing a new gem | |
| # is dead simple: | |
| # |
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
| # Hello, I made this simple ruby one liner that I found useful when inspecting ruby object I don't know much about | |
| # It simply calls all the callable methods of the given object and presents a simple result. | |
| # USAGE: | |
| # replace the 'object' variable (Time.now in the example) with your favourite object | |
| # irb version: | |
| object = Time.new; (object.methods - Object.methods).map{ |m| meth = object.method(m.to_sym); begin; [meth.name, meth.call] if meth.arity == 0; rescue Exception; end }.compact | |
| # readable version: |
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
| # from: http://kfahlgren.com/blog/2006/11/01/multipart-post-in-ruby-2/ | |
| # edited by makevoid, http://makevoid.com | |
| URL = "http://localhost:3000/your_url" | |
| TIMEOUT_SECONDS = 10 | |
| params = {} | |
| file = File.open(filename, "rb") | |
| params["file[replay]"] = file |
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
| url = URI.parse('http://www.example.com/todo.cgi') | |
| req = Net::HTTP::Post.new(url.path) | |
| req.basic_auth 'jack', 'pass' | |
| req.set_form_data({'from'=>'2005-01-01', 'to'=>'2005-03-31'}, ';') | |
| res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) } | |
| case res | |
| when Net::HTTPSuccess, Net::HTTPRedirection | |
| # OK | |
| else | |
| res.error! |
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
| objects = {} | |
| p ObjectSpace.each_object{|obj| objects[obj.class] += 1} | |
| pp objects.sort_by{|k,v| -v} |
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
| // usage: | |
| NSString *filePath = [self pathForItemNamed:@"file.ext" inFolder:[[NSBundle mainBundle] bundlePath]]; | |
| + (NSString *) pathForItemNamed: (NSString *) fname inFolder: (NSString *) path | |
| { | |
| NSString *file; | |
| NSDirectoryEnumerator *dirEnum = [[NSFileManager defaultManager] enumeratorAtPath:path]; | |
| while (file = [dirEnum nextObject]) { | |
| //NSLog(@"file: %@", file); | |
| if ([[file lastPathComponent] isEqualToString:fname]) |
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
| #-----------------------------------------------------------------------------------------------------------# | |
| # Example: | |
| #-----------------------------------------------------------------------------------------------------------# | |
| # | |
| # - gl_tail.yaml config file: | |
| # | |
| # servers: | |
| # server_named: | |
| # host: dns1.fooldns.com | |
| # files: /var/log/named_querylog |
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
| #-----------------------------------------------------------------------------------------------------------# | |
| # Example: | |
| #-----------------------------------------------------------------------------------------------------------# | |
| # | |
| # - gl_tail.yaml config file: | |
| # | |
| # servers: | |
| # server_named: | |
| # host: dns1.fooldns.com | |
| # files: /var/log/named_querylog |