Skip to content

Instantly share code, notes, and snippets.

View Cvetomird91's full-sized avatar

Cvetomir Denchev Cvetomird91

  • Plovdiv, Bulgaria
View GitHub Profile
#!/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
// ==UserScript==
// @name Hide navbars in AngularJS docs
// @namespace http://tampermonkey.net/
// @version 0.1
// @description hide annoying parts in the AngularJS documentation
// @author Tsvetomir Denchev
// @match https://docs.angularjs.org/guide/*
// ==/UserScript==
(function() {
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;
@Cvetomird91
Cvetomird91 / JacksonExamples.java
Last active October 19, 2018 13:40
Map JSON data to payment objects and filter them.
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 {
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 {
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));
containsElement () {
local e match="$1"
shift
for e; do [[ "$e" == "$match" ]] && return 0; done
return 1
}
contents=()
OIFS="$IFS"
#!/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:
#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
*/
#!/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}";