Skip to content

Instantly share code, notes, and snippets.

View arcolife's full-sized avatar

Archit Sharma arcolife

View GitHub Profile
@yehosef
yehosef / query.json
Last active November 22, 2016 21:03
elasticsearch avg problem
{
"size": 0,
"query": {
"filtered": {
"query": {
"query_string": {
"query": "*",
"analyze_wildcard": true
}
},
@LinuxJedi
LinuxJedi / nginx.gdb
Created July 15, 2015 14:54
GDB functions for NGINX
define ddl
set $log = ngx_cycle->log
while ($log != 0) && ($log->writer != ngx_log_memory_writer)
set $log = $log->next
end
if ($log->wdata != 0)
set $buf = (ngx_log_memory_buf_t *) $log->wdata
dump memory debug_log.txt $buf->start $buf->end
@karpathy
karpathy / min-char-rnn.py
Last active May 28, 2024 01:55
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@bsingr
bsingr / nginx.conf
Last active October 23, 2023 05:46
Shadow traffic duplication reverse proxy
daemon off;
error_log /dev/stderr warn;
worker_processes 4;
events {
worker_connections 1024;
multi_accept on;
}
@lkraider
lkraider / generator.py
Created April 4, 2016 17:17
Terraform AWS policy generator
#!/usr/bin/env python
"""Convert CSV policies into AWS JSON format."""
import json
import csv
POLICIES = 'terraform.csv'
CRUD_COL = 2
ACTION_COL = 3
@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):
@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
@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
@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 = [
@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