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
const split = (str, nmb) => { | |
return str.split('') | |
.reduce((arr, rec) => { | |
console.log(`Arr: ${arr} Rec : ${rec}`) | |
if (arr[arr.length - 1].length < nmb) { | |
arr[arr.length - 1] = [...arr[arr.length - 1], rec] | |
return arr | |
} | |
return [...arr, [rec]] | |
}, [[]]) |
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
# private token or personal token authentication | |
import gitlab | |
gl = gitlab.Gitlab('https://gitlab.com', private_token='{your_token}') | |
# make an API request to create the gl.user object. This is mandatory if you | |
# use the username/password authentication. | |
result = [] | |
gl.auth() |
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 you gonna have more then 500 api gateways, then you gonna need to wrap this into the loop and after first 500 you gonna need to pass position parameter to get_rest_apis method | |
import boto3 | |
client = boto3.client('apigateway') | |
response = client.get_rest_apis( | |
limit=500 | |
) | |
print(f"We have {len(response['items'])} api gateways to process") | |
for apigateway in response['items']: | |
print(f"Enabling {apigateway['name']} api gateway tracing") |
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
<!--To center an image--> | |
<p align="center"> | |
![alt]() | |
</p> | |
<!--To right align an image--> | |
<p align="right"> | |
![alt]() | |
</p> |
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
#!/usr/bin/env python | |
import SimpleHTTPServer, BaseHTTPServer, SocketServer, socket, time, sys | |
class ThreadedHTTPServer(SocketServer.ThreadingMixIn, | |
BaseHTTPServer.HTTPServer) : | |
""" | |
New features w/r to BaseHTTPServer.HTTPServer: | |
- serves multiple requests simultaneously | |
- catches socket.timeout and socket.error exceptions (raised from |
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
echo "1234567890" | cut -b 1-6 |
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
echo "1234567890" | cut -b 1-6 |
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 LoginPage { | |
func login(with userName: String, and password: String): SomeOtherPage { | |
return XCTContext.runActivity("Login as existing user") { | |
this.enter(userName: userName) | |
this.enter(password: password) | |
this.submit() | |
return new SomeOtherPage(app: this.app); | |
} | |
} |
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
FROM alpine:3.9 | |
RUN apk --no-cache add ca-certificates wget bash \ | |
&& wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \ | |
&& wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-2.29-r0.apk \ | |
&& apk add glibc-2.29-r0.apk | |
RUN wget https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.69.0/pact-1.69.0-linux-x86_64.tar.gz \ | |
&& tar xzf pact-1.69.0-linux-x86_64.tar.gz \ | |
&& rm -rf pact-1.69.0-linux-x86_64.tar.gz |
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 org.json.JSONArray; | |
import org.json.JSONObject; | |
import java.sql.ResultSet; | |
import java.text.DecimalFormat; | |
import java.text.DecimalFormatSymbols; | |
import java.util.Locale; | |
/** | |
* Utility for converting ResultSets into some Output formats |