Skip to content

Instantly share code, notes, and snippets.

View 40a's full-sized avatar

40a

View GitHub Profile

In a terminal start a server.

$ python -m SimpleHTTPServer 8000

In another terminal set up the cgroups freezer.

@HSPDev
HSPDev / AllowSSHFromIP.php
Created July 2, 2018 22:56
Complementary code and IAM policy for "You don't need that Bastion host"
<?php
// For laravel 5 based systems
// /path/to/project/app/Console/Commands/AllowSSHFromIP.php
namespace App\Console\Commands;
use Aws\Ec2\Ec2Client;
use Carbon\Carbon;
use Illuminate\Console\Command;
@endofcake
endofcake / cfn.tf
Created May 23, 2018 08:45
Auto Scaling group managed in CloudFormation and wrapped in Terraform
resource "aws_cloudformation_stack" "autoscaling_group" {
name = "${var.cfn_stack_name}"
template_body = <<EOF
Description: "${var.cfn_stack_description}"
Resources:
ASG:
Type: AWS::AutoScaling::AutoScalingGroup
Properties:
VPCZoneIdentifier: ["${join("\",\"", var.subnets)}"]
@ToniWonKanobi
ToniWonKanobi / custom.scss
Last active August 6, 2025 05:03
Custom Stylesheet for Desktop Safari
// Variables
// Color for <code> and <pre>
$lighterGray: lighten(black, 25%);
// Background color for <code>
$lightGray: lighten(lightgray, 10%);
// Border color for <pre> and <code>
$darkGray: darken(lightgray, 3%);
// Background color of YouTube
$darkerGray: darken(gray, 35%);
@cmosgh
cmosgh / Jenkinsfile
Created March 12, 2018 06:56
Jenkins stages with different containers
podTemplate(label: 'mypod',
containers: [
containerTemplate(name: 'docker', image: 'docker', ttyEnabled: true, command: 'cat'),
containerTemplate(name: 'kubectl', image: 'lachlanevenson/k8s-kubectl:v1.9.3',command:'cat', ttyEnabled: true),
containerTemplate(name: 'node', image: 'node:8.10-alpine', command: 'cat', ttyEnabled: true),
containerTemplate(name: 'helm', image: 'lachlanevenson/k8s-helm', ttyEnabled: true, command: 'cat', priviledged: true)
],
volumes:[
hostPathVolume(mountPath: '/var/run/docker.sock', hostPath: '/var/run/docker.sock'),
]
@alexellis
alexellis / configure.sh
Created January 27, 2018 10:45
Kubernetes-weave-ubuntu.sh
#!/bin/sh
sudo apt-get update \
&& sudo apt-get install -qy docker.io
sudo apt-get update \
&& sudo apt-get install -y apt-transport-https \
&& curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
@Moutard3
Moutard3 / mp3-upload-direct-link.md
Last active November 19, 2025 19:14
Tutorials / Walkthrough for uploading & getting direct link of sound file (mp3, ogg, ...)
@rwaldron
rwaldron / Setting up Google Cloud Storage with CORS for Web Fonts.md
Created January 16, 2018 21:47 — forked from mhulse/Setting up Google Cloud Storage with CORS for Web Fonts.md
Setting up CORS on Google Cloud Storage: An unofficial quick start guide to serving web fonts from Google's cloud. (I'm sure a lot of this info could be improved... Please leave comments if you have tips/improvements.)

Login:

Google Cloud Storage

You'll want to login using an official Google account (i.e. if this is for your company, use the comapany Gmail account vs. a personal one.)

When logging in, you might be prompted to verify the account; if so, enter your cell number to get a verification e-mail or phone call.

Once verified, you'll have to agree to the terms of service; do that, and click continue.

@WoZ
WoZ / README.md
Last active January 6, 2020 10:52
Strace reads and writes analyzer

Usage: node strace_log_analyzer.js strace.log /tmp

This scripts parses input file that must contain strace log from a single thread. Then script calculates:

  • execution time of read/write syscall for each file descriptor and summarize execution time for each 1 sec period,
  • calulates amount of read/write syscalls for each file descriptor

strace log must be collcted with -t -T -f options.

#!/bin/bash
DOCKER_COMPOSE_FILES='docker-compose1.yml,docker-compose2.yml'
DOCKER_COMPOSE_UP_MODE=1 #1|0
DOCKER_COMPOSE_UP_LOG_FILE='/tmp/log.txt'
DOCKER_COMPOSE_BUILD_OPTIONS="" #any options for `docker-compose build`
DOCKER_COMPOSE_UP_OPTIONS="" #any options for `docker-compose up`
DOCKER_COMPOSE_RUN_OPTIONS="" #any options for `docker-compose run`
TEST_CONTAINERS="application1=/test.sh,application2=/test2.sh"
##### get port remover #####