Skip to content

Instantly share code, notes, and snippets.

@nicolas-g
nicolas-g / multiple_ssh_and_github_setup.md
Last active June 23, 2021 19:55
Use different SSH Keys for different Github accounts

Multiple SSH Keys settings for different github account

Generate different SSH keys

create different ssh key for work and for personal use

ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519_personal -C "personal@laptop"
@nicolas-g
nicolas-g / bash-to-zsh-hist.py
Created March 30, 2021 18:14 — forked from muendelezaji/bash-to-zsh-hist.py
Convert Bash history to Zsh history
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This is how I used it:
# $ cat ~/.bash_history | python bash-to-zsh-hist.py >> ~/.zsh_history
import sys
import time

I have two python scripts, the first one will create a file defining some variables and the second one will import the first and read the created file. The problem is the second script cannot load the variables fromt the file created.

$ ls
create_file.py  read_file.py
$ ./create_file.py
file created
@nicolas-g
nicolas-g / nginx.conf
Last active June 21, 2018 18:58 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/. . Cloned from https://gist.github.com/plentz/6737338
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@nicolas-g
nicolas-g / contour-deployment-rbac.yaml
Last active April 19, 2018 21:35
Kubernetes Yaml files
# NG: This was taken from https://j.hept.io/contour-deployment-rbac
# or https://raw.githubusercontent.com/heptio/contour/master/deployment/render/deployment-rbac.yaml
# following the tutorial https://blog.heptio.com/how-to-deploy-web-applications-on-kubernetes-with-heptio-contour-and-lets-encrypt-d58efbad9f56
#
#
# This file is generated from the individual yaml files by deployment/render.sh.
# Do not edit this file directly but instead edit the source files and
# re-render.
apiVersion: v1
kind: Namespace

Keybase proof

I hereby claim:

  • I am nicolas-g on github.
  • I am nicolasg7 (https://keybase.io/nicolasg7) on keybase.
  • I have a public key ASDmn-I51bLAJaRpZDetS5T4YhlOE93HyTW2gFC436UfTgo

To claim this, I am signing this object:

@nicolas-g
nicolas-g / GitHub-API.md
Last active October 7, 2018 15:40 — forked from caniszczyk/clone-all-twitter-github-repos.sh
Clone all repos from a GitHub organization

https://developer.github.com/v3/oauth/#create-a-new-authorization

I'm using Github API to ge the list of public repos , just change type=private or all . The results are paginated ,by 30 by default, you can specify further pages with the ?page parameter : curl -u "$USER:$PASSWORD" -H 'X-GitHub-OTP: $TWOFACTORCODE' https://api.github.com/orgs/magnetic/repos\?type\=public\&page\=1 | jq '.[] | .full_name '

Clone all curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'

@nicolas-g
nicolas-g / raid_ephemeral.sh
Created October 18, 2016 17:23 — forked from joemiller/raid_ephemeral.sh
detect all ephemeral disks on EC2 then stripe together in a raid-0 vol mounted at /mnt
#!/bin/bash
#
# this script will attempt to detect any ephemeral drives on an EC2 node and create a RAID-0 stripe
# mounted at /mnt. It should be run early on the first boot of the system.
#
# Beware, This script is NOT fully idempotent.
#
METADATA_URL_BASE="http://169.254.169.254/2012-01-12"
#!/bin/bash -v
# Install prereguisites
yum update ca-certificates -y
yum install epel-release -y
yum install ansible -y
yum install git -y
yum install s3cmd -y
# setup private key that will be used to clone git repo