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
#!/bin/sh | |
# Check if the passed version is greater than the versions registered in the git tags | |
# Uses sort -V from GNU sort to sort versions and assumes git tags in | |
# semver format v<major>.<minor>.<patch> | |
check_version="$1" | |
if [ -z "$check_version" ]; then | |
# Assume it's not the latest version | |
echo "No version specified. Usage: $0 <version>" | |
echo "Example: $0 v1.1.0 -> checks if v1.1.0 is greater than the versions in the git tags" |
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 python3 | |
import socket | |
import sys | |
def main(argv): | |
multicast_group = argv[1] | |
multicast_port = int(argv[2]) | |
interface_ip = argv[3] |
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
import com.google.zxing.*; | |
import com.google.zxing.client.j2se.BufferedImageLuminanceSource; | |
import com.google.zxing.common.HybridBinarizer; | |
import com.google.zxing.multi.GenericMultipleBarcodeReader; | |
import javax.imageio.ImageIO; | |
import java.awt.image.BufferedImage; | |
import java.io.BufferedInputStream; | |
import java.io.File; | |
import java.io.FileInputStream; |
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
# in extra.api.views | |
class CustomFieldChoicesViewSet(FieldChoicesViewSet): | |
def __init__(self, *args, **kwargs): | |
super(CustomFieldChoicesViewSet, self).__init__(*args, **kwargs) | |
self._fields = OrderedDict() | |
for cfc in CustomFieldChoice.objects.all(): | |
self._fields.setdefault(cfc.field.name, []) | |
self._fields[cfc.field.name].append({'value': cfc.pk, 'label': cfc.value}) |
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 concurrent.futures import ThreadPoolExecutor | |
from time import sleep | |
executor = ThreadPoolExecutor(max_workers=10) | |
MAX_RUN_TIME = 4.5 | |
SLEEP_BETWEEN_WAITS = 0.1 | |
def return_slept(sleep_time): | |
sleep(sleep_time) |
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
#!/bin/bash | |
if git rev-parse --verify HEAD >/dev/null 2>&1 | |
then | |
against=HEAD | |
else | |
exit 0 | |
fi | |
set -e |
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
#!/bin/bash | |
cert="$1" | |
key="$2" | |
if [ -z "$cert" -o ! -e "$cert" ]; then | |
echo "Usage: $0 <cert.pem> [cert.key]" | |
exit 1 | |
fi |
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
sub ipv6OctString | |
{ | |
my $v6Addr = shift; | |
my $res = ''; | |
foreach $_ (split(/:/, $v6Addr)) | |
{ | |
if (/^([0-9a-f]{2})([0-9a-f]{2})$/) | |
{ |
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
sub expandIpv6Addr | |
{ | |
my $addr = shift; | |
my @parts = split(/:/, $addr); | |
my $numParts = scalar @parts; | |
my @res; | |
my $i = 0; | |
foreach my $addrPart (@parts) | |
{ |
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 python | |
import crypt | |
import random | |
import string | |
import sys | |
PASSWORD_CHARS = string.ascii_uppercase + string.ascii_lowercase + string.digits | |
MD5_SALT_CHARS = PASSWORD_CHARS + '/' | |
DES_SALT_CHARS = string.ascii_uppercase + string.ascii_lowercase |
NewerOlder