Hero Discussion of the Day: Morphling (September 14, 2011)
Hero Discussion of the Day: Axe (September 15, 2011)
Hero Discussion of the Day: Nature's Prophet (September 16, 2011)
Hero Discussion of the Day: Night Stalker (September 17, 2011)
import subprocess | |
def looksLikeBeginning(doc,seg,adr): | |
if isinstance(seg.getNameAtAddress(adr), str): | |
label = seg.getNameAtAddress(adr) | |
pos = label.find("_T") | |
if pos != -1: | |
return label[pos:] | |
return None |
# ATTENTION: This is now supported in plug_cowboy as of 2.1.0: | |
# https://hexdocs.pm/plug_cowboy/Plug.Cowboy.Drainer.html | |
defmodule DrainStop do | |
@moduledoc """ | |
DrainStop Attempts to gracefully shutdown an endpoint when a normal shutdown | |
occurs. It first shuts down the acceptor, ensuring that no new requests can be | |
made. It then waits for all pending requests to complete. If the timeout | |
expires before this happens, it stops waiting, allowing the supervision tree | |
to continue its shutdown order. |
#!/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -i -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk | |
import Foundation | |
class JSON { | |
struct Path: Printable { | |
enum Element { | |
case Index(Int) | |
case Key(String) |
// FILED: rdar://17240493 | |
// Type constraint ignored on function type parameter | |
// | |
protocol BoolT {} | |
class TrueT : BoolT {} | |
class FalseT : BoolT {} | |
protocol Nat { | |
typealias IsZero |
// | |
// Trie.swift | |
// SceneTest | |
// | |
// Created by Greg Titus on 6/7/14. | |
// Copyright (c) 2014 The Omni Group. All rights reserved. | |
// | |
// This is essentially the same data structure as OFTrie in OmniFoundation, except that the OmniFoundation version is mutable and ephemeral, | |
// and this version is immutable and persistent. Every time you add a string to the trie, it replaces all the nodes along the string's path |
# UPD from 2018: | |
# This gist was written for pre-1.0 version of Elixir and won't work on post-1.0 versions. | |
# You probably consider using something else! | |
defmodule SecureRandom do | |
@moduledoc """ | |
Ruby-like SecureRandom module. | |
## Examples |
# If your Chef version is earlier than 11.0.0, use version 1.10.0 of this cookbook: https://github.com/opscode-cookbooks/apt/commit/dd29a85257161ff42c9595627dd370b02be2060f | |
vagrant halt | |
cd cookbooks/apt | |
git reset --hard 1.10.0 | |
vagrant up |
// For details, see http://mindsea.com/2012/12/18/downscaling-huge-alassets-without-fear-of-sigkill | |
#import <AssetsLibrary/AssetsLibrary.h> | |
#import <ImageIO/ImageIO.h> | |
// Helper methods for thumbnailForAsset:maxPixelSize: | |
static size_t getAssetBytesCallback(void *info, void *buffer, off_t position, size_t count) { | |
ALAssetRepresentation *rep = (__bridge id)info; | |
NSError *error = nil; |
-export([graceful_stop/1, graceful_stop_proc/1]). | |
graceful_stop(Timeout) -> | |
lists:foreach(fun stop_listener/1, supervisor:which_children(cowboy_sup)), | |
proc_lib:spawn(?MODULE, graceful_stop_proc, [Timeout]). | |
graceful_stop_proc(Timeout) -> | |
true = register(graceful_stop, self()), | |
lager:critical("SHUTDOWN with timeout of ~p msec", [Timeout]), | |
TRef = erlang:start_timer(Timeout, self(), not_so_graceful), |