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
ROLENAME=$1 | |
ACCOUNTID=$(aws sts get-caller-identity --query "Account" --output text) | |
JSON=$(aws sts assume-role --role-arn arn:aws:iam::$ACCOUNTID:role/$ROLENAME --role-session-name run) | |
echo $JSON | jq -r '.Credentials | "export AWS_ACCESS_KEY_ID=\"\(.AccessKeyId)\""' | |
echo $JSON | jq -r '.Credentials | "export AWS_SECRET_ACCESS_KEY=\"\(.SecretAccessKey)\""' | |
echo $JSON | jq -r '.Credentials | "export AWS_SESSION_TOKEN=\"\(.SessionToken)\""' |
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 | |
# Requires AWS CLI v2 | |
#Usage ./remove_events_rules.sh <rule name, or partial name> | |
set -eo pipefail | |
echo "Searching rules for $1"; | |
rules=$(aws events list-rules |jq -r '.Rules[].Name'|grep $1); | |
echo "Deleting rules:\n$rules"; | |
read -p "Confirm (y/n)?" -n 1 -r | |
if [[ ! $REPLY =~ ^[Yy]$ ]] |
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
public class BitShitCrypt { | |
public static byte[] encrypt(byte[] data) { | |
if (data == null) return null; | |
byte r=(byte)0x00; | |
for (int i=0;i<data.length;i++) { | |
byte lr = (byte)(data[i]&0x03); | |
data[i]=(byte)(data[i]>>2 | r); | |
r=(byte)(lr<<6); | |
if (i+1==data.length) { |
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 | |
########################################################################### | |
# /usr/local/bin/x11vnc-start | |
# Starts VNC server for the current session | |
# | |
# Gustavo Neves - 4th Jul 2016 | |
# | |
# Install x11vnc: | |
# sudo apt-get install x11vnc |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
<script type="text/javascript" src="jquery-3.1.1.min.js"></script> | |
<style media="screen"> | |
html, body{ | |
width: 100%; | |
height: 100%; |
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
from OpenSSL import crypto | |
import os | |
fk = open('security/server.key','r') | |
k = crypto.load_privatekey(crypto.FILETYPE_PEM, fk.read()) | |
fcert = open('security/server.crt','r') | |
cert = crypto.load_certificate(crypto.FILETYPE_PEM, fcert.read()) | |
signature = crypto.sign(k, 'data', 'sha1') | |
try: | |
crypto.verify(cert, signature, 'data', 'sha1') |
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
#job searcher crawler | |
import scrapy | |
class BlogSpider(scrapy.Spider): | |
name = 'blogspider' | |
start_urls = ['https://www.bcjobs.ca/search-jobs?q=cloud'] | |
pagecount = 2 | |
def parse(self, response): | |
for it in response.css('a.list-item-wrapper'): |
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 sys | |
a=[18897109,12828837, 9461105, 6371773, 5965343, 5946800, 5582170, 5564635, 5268860, 4552402, 4335391, 4296250, 4224851, 4192887, 3439809, 3279833, 3095313, 2812896, 2783243, 2710489, 2543482, 2356285, 2226009, 2149127, 2142508, 2134411] | |
CUT=100000000 | |
#a=[1,2,3,4] | |
#CUT=5 | |
# the recursion | |
def r(pos, level): | |
global a | |
if level == 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
package main | |
import ( | |
"fmt" | |
) | |
func check(tab [3][3]int) int { | |
if tab[0][0] == tab[1][0] && tab[0][0] == tab[2][0] && tab[0][0] > 0{ | |
return tab[0][0] | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
<style media="screen"> | |
.holder { | |
width: 100px; | |
height: 100px; | |
float: left; |
NewerOlder