Skip to content

Instantly share code, notes, and snippets.

View arcolife's full-sized avatar

Archit Sharma arcolife

View GitHub Profile
@dopey
dopey / main.go
Last active May 18, 2024 23:34 — forked from denisbrodbeck/main.go
How to generate secure random strings in golang with crypto/rand.
package main
import (
"crypto/rand"
"encoding/base64"
"fmt"
"io"
"math/big"
)
@Ladas
Ladas / count_records.rb
Last active August 20, 2017 11:42
Models Count for Containers, run as ```bundle exec rails r count_records.rb```
classes = [
Authentication,
ComputerSystem,
Container,
ContainerBuild,
ContainerBuildPod,
ContainerComponentStatus,
ContainerCondition,
ContainerEnvVar,
ContainerGroup,
@mmellison
mmellison / grpc_asyncio.py
Last active April 3, 2024 15:48
gRPC Servicer with Asyncio (Python 3.6+)
import asyncio
from concurrent import futures
import functools
import inspect
import threading
from grpc import _server
def _loop_mgr(loop: asyncio.AbstractEventLoop):
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Brainiarc7
Brainiarc7 / build-tensorflow-from-source.md
Last active July 29, 2023 21:28
Build Tensorflow from source, for better performance on Ubuntu.

Building Tensorflow from source on Ubuntu 16.04LTS for maximum performance:

TensorFlow is now distributed under an Apache v2 open source license on GitHub.

On Ubuntu 16.04LTS+:

Step 1. Install NVIDIA CUDA:

To use TensorFlow with NVIDIA GPUs, the first step is to install the CUDA Toolkit as shown:

@smalleni
smalleni / Full-Lab-Deploy.md
Last active February 21, 2024 15:56
Deploying RHOP 10 in Red Hat Scale Lab

Full Scale Lab Deployment

Test Plan

  • Build Undercloud

  • Install Monitoring

  • Import Nodes

  • Introspect

@arsdehnel
arsdehnel / iam-terraform-create-policy.tf
Last active September 21, 2023 18:12
AWS IAM policies for running Terraform from an EC2 instance.
resource "aws_iam_policy" "terraform_create_policy" {
name = "terraform_create_policy"
path = "/"
policy = "${data.aws_iam_policy_document.terraform_create_policy.json}"
}
data "aws_iam_policy_document" "terraform_create_policy" {
statement {
sid = "1"
actions = [
@garethahealy
garethahealy / jcmd.sh
Created January 5, 2017 18:03
java heapdump for docker
#!/bin/bash
docker exec $1 ps -deaf
echo -n "PID for Java: "
read pid
docker exec $1 jcmd $pid GC.heap_dump /tmp/docker.hprof
docker cp $1:/tmp/docker.hprof .
docker exec $1 rm /tmp/docker.hprof
@thomasdarimont
thomasdarimont / readme.md
Last active May 20, 2024 22:58
Example for decoding a JWT Payload with your Shell (bash, zsh...)

Setup

Add this to your .profile, .bashrc, .zshrc...

decode_base64_url() {
  local len=$((${#1} % 4))
  local result="$1"
  if [ $len -eq 2 ]; then result="$1"'=='
  elif [ $len -eq 3 ]; then result="$1"'=' 
  fi
 echo "$result" | tr '_-' '/+' | openssl enc -d -base64
@fx86
fx86 / string_similarity.py
Created May 28, 2016 11:15
A much more effective algorithm for string similarity found on Stack Overflow
import wikipedia
def get_bigrams(string):
'''
Takes a string and returns a list of bigrams
'''
s = string.lower()
return [s[i:i+2] for i in xrange(len(s) - 1)]
def string_similarity(str1, str2):