Skip to content

Instantly share code, notes, and snippets.

# Check server process is using jemalloc
# ref. [Japanese] https://tech.studyplus.co.jp/entry/2019/09/09/094140
class AppController < ActionController::Base
def show
r = `strings /proc/#{Process.pid}/maps | grep jemalloc`
render plain: "<h1>#{ENV['LD_PRELOAD'].presence || 'empty'}</h1><pre>#{r}</pre>"
end
end
@tlopo
tlopo / self_signed_cert.rb
Created November 24, 2022 12:07 — forked from nickyp/self_signed_cert.rb
create a self-signed certificate using ruby-openssl
We couldn’t find that file to show.
@tlopo
tlopo / default.conf
Created December 15, 2020 14:13 — forked from flox1an/default.conf
nginx config that uses the oauth2-proxy (via auth_request) to authenticate against gitlab and then proxies all requests to a backend service while setting the auth headers X-User and X-Email
server {
listen 80;
server_name localhost;
location /oauth2/ {
proxy_pass http://oauth-proxy:4180;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Auth-Request-Redirect $request_uri;
@tlopo
tlopo / Decode-Base64.md
Created December 12, 2020 13:15 — forked from mmaha/Decode-Base64.md
Decode SAML Assertion in Base64

Perl

perl -MMIME::Base64 -ne 'print decode_base64($_)' ./saml_input.txt | xmllint --format - | source-highlight  -s xml -f esc

Ruby

cat ./saml_input.txt | ruby -r Base64 -ne 'puts Base64.decode64($_)' | xmllint --format - | source-highlight  -s xml -f esc
@tlopo
tlopo / build.sh
Created November 27, 2020 21:36 — forked from sheeley/build.sh
Terraform API Gateway Lambda setup
#! /usr/bin/env bash
GOOS=linux GOARCH=amd64 go build -o main main.go
zip main.zip main
@tlopo
tlopo / Dockerfile
Created February 24, 2020 10:17 — forked from andrewodri/Dockerfile
Connect Fargate instance to SSM Session Manager
FROM debian:10-slim
RUN apt-get update -y && \
apt-get install -y awscli curl gnupg && \
apt-key adv --fetch-keys "https://nginx.org/keys/nginx_signing.key" && \
echo "deb http://nginx.org/packages/debian buster nginx" > /etc/apt/sources.list.d/nginx.list
RUN curl --silent --show-error --location --output /tmp/amazon-ssm-agent.deb "https://s3.us-east-1.amazonaws.com/amazon-ssm-us-east-1/latest/debian_amd64/amazon-ssm-agent.deb" && \
dpkg -i /tmp/amazon-ssm-agent.deb
@tlopo
tlopo / _aws_golang_examples.md
Created November 5, 2019 17:51 — forked from eferro/_aws_golang_examples.md
golang aws: examples

AWS Golang SDK examples

@tlopo
tlopo / Selenium Cheat Sheet.md
Created July 30, 2019 21:12 — forked from kenrett/Selenium Cheat Sheet.md
Selenium Cheat Sheet - Ruby

#Getting Started

##Webpage:

<html>
<head>
    <title>Testing with Ruby and Selenium WebDriver</title>
</head>
 
<body bgcolor="antiquewhite">
@tlopo
tlopo / Makefile
Created May 8, 2019 08:06 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@tlopo
tlopo / CP1.md
Created March 1, 2018 19:42 — forked from sharmaeklavya2/CP1.md
Getting started with Competitive Programming

Starting out with Competitive Programming

(This guide is meant for beginners. If you have solved 100+ problems and are looking for guidance on how to solve problems involving algorithms and data structures, this document is not for you.)

Competitive Programming is an interesting activity which mixes problem solving with programming. It is not only enjoyable but also very demanded in placements. Competitive programming will make you very good at writing efficient programs quickly.