Skip to content

Instantly share code, notes, and snippets.

View vpistis's full-sized avatar
🎯
Focusing

Valentino Pistis vpistis

🎯
Focusing
  • 20:33 (UTC +01:00)
View GitHub Profile
@matteomallus
matteomallus / vue_docker
Last active June 15, 2020 18:29
Dockerfile for vue build multistage
=================================================================================
## Dockerfile MULTISTAGE
FROM node:12.11.1-alpine as node_build
RUN apk add --update --no-cache nginx==1.14.2-r5
RUN npm i -g [email protected]
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
@joepie91
joepie91 / vpn.md
Last active November 18, 2024 12:41
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@mattlong
mattlong / admin.py
Created September 17, 2014 18:26
Add a custom admin page for a model and link to it from the detail page
from functools import update_wrapper
from django.contrib import admin
from django.contrib.admin import ModelAdmin
from django.contrib.admin.templatetags.admin_urls import add_preserved_filters
from django.core.exceptions import PermissionDenied
from django.shortcuts import render
from myapp.models import Widget
from myapp.forms import ManageWidgetForm
@tsabat
tsabat / chef_userdata.sh
Last active December 19, 2015 03:38
The user data passed to codepen's launch config.
#!/bin/bash -ex
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
echo BEGIN
EC2_HOSTNAME=`ec2metadata --public-hostname`
EC2_HOST=`echo $EC2_HOSTNAME | cut -d. -f1`
EC2_HOST=$EC2_HOST.`echo $EC2_HOSTNAME | cut -d. -f2`
if [ -a /etc/chef/client.pem ]; then
rm /etc/chef/client.pem
@tsabat
tsabat / deploy_utils.rb
Last active April 13, 2016 16:46
A ruby script to get all instances with a given tags.
require 'aws-sdk'
require 'awesome_print'
class AwsUtil
def ec2_object
# deployer user, has read-only access
AWS::EC2.new(
access_key_id: "<your_key_here>",
secret_access_key: "<your_secret_here>",
@tsabat
tsabat / prep_instance.py
Last active December 19, 2015 03:29
Given a tag, search for the most recent snapshot, create a volume and mount it.
#! /usr/bin/python
from boto import ec2
import boto.utils
import argparse, time, os, json
def parsed_args():
parser = argparse.ArgumentParser()
parser.add_argument("-g", "--instance_tags",
help='the tags you want to apply to your instance. default: {"Name","app", "Environment":"Production", "Role":"app"}',
@tsabat
tsabat / snapshot.py
Last active May 3, 2016 17:19
A python script to snapshot the volume attached to an instance.
#! /usr/bin/python
from boto import ec2;
import boto.utils
import argparse
def parsed_args():
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--instance_id",
help="the instance id you want to snapshot. default: current instance id",