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 | |
REGEX='Matches found for \d* Hz'; | |
MATCHES_FILE='matches.txt'; | |
grep -riP "$REGEX" > "$MATCHES_FILE"; | |
cat $MATCHES_FILE | grep -ohP "$REGEX" | grep -oP \\d* > frequencies.txt | |
readarray matches < frequencies.txt |
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.fasterxml.jackson.databind.JsonNode; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import com.fasterxml.jackson.databind.node.ArrayNode; | |
import java.io.File; | |
import java.io.IOException; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Arrays; |
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.fasterxml.jackson.databind.ObjectMapper; | |
import java.io.File; | |
import java.io.IOException; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Arrays; | |
public class JacksonExamples { | |
public static void main(String[] args) throws IOException { |
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 java.time.*; | |
import java.time.format.DateTimeFormatter; | |
import java.time.format.FormatStyle; | |
import java.time.Month; | |
//basic examples of the Java 8 date/time API | |
public class Timing extends MyClass { | |
public static void main(String[] args) throws DateTimeException { |
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 java.util.*; | |
import java.util.function.*; | |
public class PredicateSearch { | |
public static void main(String[] args) { | |
List<Animal> animals = new ArrayList<Animal>(); | |
animals.add(new Animal("fish", false, true)); | |
animals.add(new Animal("shark", false, true)); | |
animals.add(new Animal("monkey", true, false)); |
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
containsElement () { | |
local e match="$1" | |
shift | |
for e; do [[ "$e" == "$match" ]] && return 0; done | |
return 1 | |
} | |
contents=() | |
OIFS="$IFS" |
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 python2.4 | |
import os | |
import string | |
path = "/var/spool/asterisk/monitor/" | |
def make_safe_filename(file): | |
safechars = string.letters + string.digits + "-_." | |
try: |
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
#include <iostream> | |
#include <array> | |
#include <string> | |
/* | |
an example of how to allocate an array of objects on the heap, | |
how to call the default constructor (the one without arguments), | |
and how to free that array of objects from memory afterwards | |
*/ |
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 bash | |
ip_ranges=($(whois -h whois.radb.net -- '-i origin AS32934' | grep ^route: | awk '{print $2}')); | |
ranges=(); | |
for ip_range in ${ip_ranges[@]}; do | |
MINADDR=$(ipcalc --minaddr ${ip_range} | awk -F'=' '{print $2}'); | |
MAXADDR=$(ipcalc --maxaddr ${ip_range} | awk -F'=' '{print $2}'); | |
RANGE="${MINADDR}-${MAXADDR}"; |