Enter this in the search box along with your search terms:
Get all gists from the user santisbon.
user:santisbon
Find all gists with a .yml extension.
extension:yml
Find all gists with HTML files.
language:html
// https://www.michaelpollmeier.com/2014/06/29/simple-dependency-injection-scala | |
// define | |
trait MyService { | |
def foo = 42 | |
} | |
// instantiate | |
object MyService extends MyService |
#!/usr/bin/env bash | |
# set -xv | |
user=$1 | |
pass=$2 | |
# get token | |
pass_md5="$(echo -n "$pass" | md5)" | |
pass_sha512="$(echo -n "${pass}"'ewor88493GVHBMe@' | sha512sum | cut -f1 -d' ')" |
Enter this in the search box along with your search terms:
Get all gists from the user santisbon.
user:santisbon
Find all gists with a .yml extension.
extension:yml
Find all gists with HTML files.
language:html
#!/usr/bin/env python3 | |
import pandas as pd | |
import requests | |
import json | |
import sys | |
base_url='https://dev.virtualearth.net' | |
api='REST/v1/Routes/Truck' |
from datetime import datetime | |
import time | |
def as_epoch(row): | |
dt = datetime.strptime(row['gps_timestamp'], '%Y-%m-%d %H:%M:%S%z') | |
return int(time.mktime(dt.timetuple())) | |
df['epoch'] = df.apply (lambda row: as_epoch(row), axis=1) | |
df = df.drop('gps_timestamp', axis=1) | |
df = df.sort_values('epoch') |
#!/usr/bin/env bash | |
index="$1" | |
pattern="$2" | |
size="$3" | |
query="http://ek-elasticsearch.rivigo.com/${index}/_doc/_search?q=stackTrace:${pattern}&_source=stackTrace&scroll=10m&size=${size}&filter_path=hits.hits._source.stackTrace" | |
curl -s -XGET "${query}" | jq ".hits.hits[]._source.stackTrace" -r |
// cat payload.json | openssl sha256 -hmac 'secret' | |
import javax.crypto.Mac; | |
import javax.crypto.spec.SecretKeySpec; | |
val payload = scala.io.Source.fromFile("payload.json").mkString | |
val secret = "secret" | |
val sha256_HMAC = Mac.getInstance("HmacSHA256") | |
val secret_key = new SecretKeySpec(secret.getBytes("UTF-8"), "HmacSHA256"); | |
sha256_HMAC.init(secret_key) |
/** | |
* D Holbrook | |
* | |
* Code Club: PO1 | |
* | |
* (*) Define a binary tree data structure and related fundamental operations. | |
* | |
* Use whichever language features are the best fit (this will depend on the language you have selected). The following operations should be supported: | |
* | |
* Constructors |
# Enter your code here. Read input from STDIN. Print output to STDOUT | |
from collections import defaultdict | |
from copy import deepcopy | |
def get_adj_list_and_zero_degree(no_of_nodes, all_edges): | |
all_node_nos = {i for i in range(no_of_nodes)} | |
adj_mat = defaultdict(list) | |
in_nodes = set() | |
for e in all_edges: | |
adj_mat[e[0]].append(e[1]) |
#!/usr/bin/env python | |
import boto3 | |
rds = boto3.client('rds', region_name='ap-south-1') | |
dbs = rds.describe_db_instances() | |
def get_tags_for_db(db): | |
instance_arn = db['DBInstanceArn'] | |
instance_tags = rds.list_tags_for_resource(ResourceName=instance_arn) |