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
# | |
# https://help.github.com/articles/dealing-with-line-endings/ | |
# | |
# These are explicitly windows files and should use crlf | |
*.bat text eol=crlf |
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
def modular_sqrt(a, p): | |
def legendre_symbol(a, p): | |
""" Compute the Legendre symbol a|p using | |
Euler's criterion. p is a prime, a is | |
relatively prime to p (if p divides | |
a, then a|p = 0) | |
Returns 1 if a has a square root modulo | |
p, -1 otherwise. |
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
# Basics of Elliptic Curve Cryptography implementation on Python | |
import collections | |
def inv(n, q): | |
"""div on PN modulo a/b mod q as a * inv(b, q) mod q | |
>>> assert n * inv(n, q) % q == 1 | |
""" | |
for i in range(q): | |
if (n * i) % q == 1: |
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
''' | |
620031587 | |
Net-Centric Computing Assignment | |
Part A - RSA Encryption | |
''' | |
import random | |
''' |
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 | |
p = 61 | |
q = 53 | |
n = p*q | |
phi = (p-1)*(q-1) | |
# Took from SO | |
def egcd(a, b): |
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
private static byte[] intToLittleEndian(long numero) { | |
ByteBuffer bb = ByteBuffer.allocate(4); | |
bb.order(ByteOrder.LITTLE_ENDIAN); | |
bb.putInt((int) numero); | |
return bb.array(); | |
} | |
// OR ... | |
private static byte[] intToLittleEndian(long numero) { |
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
if [ ! -f .env ] | |
then | |
export $(cat .env | xargs) | |
fi | |
# or | |
set -o allexport | |
source .env |
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
class Main { | |
public static void main(String[] args) { | |
System.out.println("Hello world!"); | |
retry("foo"); | |
} | |
static void retry(String... args) { | |
boolean retry = true; | |
int attempts = 0; | |
int maxAttempts = 10; |
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
// List container logs per namespace | |
// View container logs from all the namespaces in the cluster. | |
let window=ago(48h); | |
ContainerLog | |
|join(KubePodInventory |where TimeGenerated > startofday(window))//KubePodInventory Contains namespace information | |
on ContainerID | |
|where TimeGenerated > startofday(window) | |
|where LogEntry contains "failed to start" | |
| project ContainerID, TimeGenerated ,Namespace , LogEntrySource , LogEntry |
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
apiVersion: apps/v1beta1 | |
kind: Deployment | |
metadata: | |
name: kuard-deployment | |
labels: | |
app: kuard | |
spec: | |
replicas: 3 | |
selector: | |
matchLabels: |