Skip to content

Instantly share code, notes, and snippets.

View zerogvt's full-sized avatar

Vasilis zerogvt

  • Greece
View GitHub Profile
@zerogvt
zerogvt / gist:5f655034c153c9f07d0a
Created June 8, 2015 16:28
com.suse.saltstack.netapi.event.JerseyServerSentEventsTest.txt
-------------------------------------------------------------------------------
Test set: com.suse.saltstack.netapi.event.JerseyServerSentEventsTest
-------------------------------------------------------------------------------
Tests run: 5, Failures: 1, Errors: 2, Skipped: 0, Time elapsed: 1.06 sec <<< FAILURE!
testEventMessageContent(com.suse.saltstack.netapi.event.JerseyServerSentEventsTest) Time elapsed: 0.163 sec <<< ERROR!
java.lang.IndexOutOfBoundsException: Index: 2, Size: 1
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at com.suse.saltstack.netapi.event.JerseyServerSentEventsTest$EventContentClient.eventStreamClosed(JerseyServerSentEventsTest.java:212)
at com.suse.saltstack.netapi.event.EventStream.close(EventStream.java:149)
@zerogvt
zerogvt / create-ssh-node.sh
Created March 23, 2018 16:34 — forked from Evildethow/create-ssh-node.sh
Jenkins: Create SSH node, using bash and curl
#!/usr/bin/env bash
set -o nounset -o errexit -o pipefail
usage() {
cat <<EOM
Usage:
$(basename $0) [OPTIONS]
$(basename $0) [ -j | --jenkins-url | -n | --node-name | -s | -d | --desc | --slave-home | -e | --executors | -sh | --ssh-host | -sp | --ssh-port
| -c | --cred-id | -l | --labels | -u | --user-id | -p | --password | -h | --help ]
@zerogvt
zerogvt / remove-nodes-safely.sh
Created July 20, 2018 10:52 — forked from scarytom/remove-nodes-safely.sh
Script to safely de-register jenkins nodes usage: $ remove-nodes-safely.sh my-node-1 my-node-2 my-node-3
#!/bin/bash
set -e
set -u
CI_MASTER_URL="http://ci-1"
node_online() {
curl --silent "$CI_MASTER_URL/computer/$1/api/json" | grep --silent '"temporarilyOffline":false'
}
@zerogvt
zerogvt / mock_requests.py
Created July 23, 2018 11:49 — forked from evansde77/mock_requests.py
Example of mocking requests calls
#!/usr/bin/env python
"""
mocking requests calls
"""
import mock
import unittest
import requests
from requests.exceptions import HTTPError
/*
Exercise: Slices
Implement Pic. It should return a slice of length dy, each element of which is a slice of dx 8-bit unsigned integers. When you run the program, it will display your picture, interpreting the integers as grayscale (well, bluescale) values.
The choice of image is up to you. Interesting functions include (x+y)/2, x*y, and x^y.
(You need to use a loop to allocate each []uint8 inside the [][]uint8.)
(Use uint8(intValue) to convert between types.)
/*
Exercise: Maps
Implement WordCount. It should return a map of the counts of each “word” in the string s. The wc.Test function runs a test suite against the provided function and prints success or failure.
You might find strings.Fields helpful.
https://tour.golang.org/moretypes/23
*/
package main
/*
Exercise: Fibonacci closure
Let's have some fun with functions.
Implement a fibonacci function that returns a function (a closure) that returns successive fibonacci numbers (0, 1, 1, 2, 3, 5, ...).
https://tour.golang.org/moretypes/26
*/
/*
Exercise: Stringers
Make the IPAddr type implement fmt.Stringer to print the address as a dotted quad.
For instance, IPAddr{1, 2, 3, 4} should print as "1.2.3.4".
https://tour.golang.org/methods/18
*/
/*
Exercise: Errors
Copy your Sqrt function from the earlier exercise and modify it to return an error value.
Sqrt should return a non-nil error value when given a negative number, as it doesn't support complex numbers.
Create a new type
type ErrNegativeSqrt float64
and make it an error by giving it a
git squash:
> git rebase -i HEAD~5
> git push --force origin yourbranchname