This file contains 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
import math | |
import random | |
class Item(object): | |
def __init__(self, label, weight): | |
self.label = label | |
self.weight = weight | |
self.nonce = 0.0 |
This file contains 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
# vim: set ai ts=4 expandtab: | |
# ::=========================================================================:: | |
cmake_minimum_required(VERSION 3.5 FATAL_ERROR) | |
# The following must be set BEFORE doing project() or enable_language(). | |
if (NOT CMAKE_BUILD_TYPE) | |
message(STATUS "No build type defined; defaulting to 'Debug'") | |
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING | |
"The type of build. Possible values are: Debug, Release, RelWithDebInfo and MinSizeRel.") |
This file contains 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
import logging | |
import socket | |
from twisted.internet import abstract, address, interfaces, defer | |
from zope.interface import implementer | |
try: | |
import netfilterqueue | |
except: | |
netfilterqueue = None |
This file contains 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
class frugal1_estimator(object): | |
def __init__(self, qtile): | |
self.qtile_target = qtile | |
self.m = 0.0 | |
def add(self, new_data): | |
r = random.random() | |
if new_data > self.m and r > (1.0 - self.qtile_target): | |
self.m += 1 | |
elif new_data < self.m and r > self.qtile_target: |
This file contains 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
# vim: set ai expandtab: | |
cmake_minimum_required(VERSION 3.2 FATAL_ERROR) | |
# The following must be set BEFORE doing project() or eanble_language(). | |
# ::-------------------------------------------------------------------------:: | |
if (NOT CMAKE_BUILD_TYPE) | |
message(STATUS "No build type defined; defaulting to 'Debug'") | |
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING | |
"The type of build. Possible values are: Debug, Release, RelWithDebInfo and MinSizeRel.") |
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <maxminddb.h> | |
int main(int argc, const char * argv[]) { | |
MMDB_s *mmdb = (MMDB_s *)malloc(sizeof(MMDB_s)); | |
MMDB_open("/tmp/GeoIP2-City_20160105/GeoIP2-City.mmdb", | |
MMDB_MODE_MMAP, mmdb); | |
int gai_error = 0; |
This file contains 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
UP |
This file contains 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
public class Rule { | |
static enum MatchAction { | |
OUTPUT, OUTPUT_WITH_TAGS, IGNORE; | |
}; | |
static enum OutputFormat { | |
KV, KV_DELIM, KV_JSON, LIST, LIST_DELIM, LIST_JSON, HASH; | |
}; | |
private String metricMatch; |
This file contains 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
/* | |
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. | |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
* | |
* This code is free software; you can redistribute it and/or modify it | |
* under the terms of the GNU General Public License version 2 only, as | |
* published by the Free Software Foundation. Oracle designates this | |
* particular file as subject to the "Classpath" exception as provided | |
* by Oracle in the LICENSE file that accompanied this code. | |
* |
This file contains 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
## If the package won't let you "Show Package Content" on right-click then... | |
pkgutil --expand Foo.pkg some/path | |
## This will probably yield one more more child .pkg files. Inside them | |
## look for the Payload file. Then... | |
mv Payload Payload.gz | |
gunzip Payload.gz | |
## Which results in Payload uncompressed. Use 'cpio' to extract files... | |
cpio -iv < Payload |
NewerOlder