Skip to content

Instantly share code, notes, and snippets.

Antonio Macías Ojeda antoniomo

Block or report user

Report or block antoniomo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tanelmae
tanelmae / k3ctx
Last active Nov 1, 2019
BASH function for managing k3d cluster contexts
View k3ctx
k3ctx() {
local CLUSTER_NAME=${1}
# Show the current context/namespace
local CTX=$(kubectl config current-context)
local NS=$(kubectl config view -o jsonpath="{.contexts[?(@.name=='$CTX')].context.namespace}")
if [[ -z $NS ]]; then
NS="default"
fi
echo "Current ctx/ns: $CTX/$NS"
@superseb
superseb / 1_README.md
Last active Dec 4, 2019
Generate Rancher 2 cluster/node agent definitions
View 1_README.md

Generate Rancher 2 cluster/node agents definitions

This is not official documentation/tooling, use with caution

This generate the Kubernetes definitions of the cattle-cluster-agent Deployment and cattle-node-agent DaemonSet, in case it's accidentally removed/server-url was changed/certficates were changed. It is supposed to run on every cluster Rancher manages. If you have custom clusters created in Rancher, see Kubeconfig for Custom clusters created in Rancher how to obtain the kubeconfig to directly talk to the Kubernetes API (as usually it doesn't work via Rancher anymore). For other clusters, use the tools provided by the provider to get the kubeconfig.

IMPORTANT: You get the cluster/node agents definitions from Rancher, and you apply them to the cluster that is created/managed so you need to switch kubeconfig to point to that cluster before applying them.

Running it

@jgreat
jgreat / README.md
Last active Dec 3, 2019
Rancher 2.0 Terraform AWS example.
View README.md

Set up a 3 node HA rancher cluster.

This will create and prep nodes for RKE. This uses the default vpc and subnets.

We create:

  • SSH Key Pair
  • Security Groups
  • 3 Instances
  • ELB for 80/443 points to the 3 instances.
@shivakar
shivakar / tls-server-in-memory-cert.go
Created Dec 12, 2015
TLS server with in-memory self-signed certificate
View tls-server-in-memory-cert.go
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
"crypto/x509/pkix"
"errors"
"log"
@lolzballs
lolzballs / HelloWorld.java
Created Mar 22, 2015
Hello World Enterprise Edition
View HelloWorld.java
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
public class HelloWorld{
private static HelloWorld instance;
public static void main(String[] args){
instantiateHelloWorldMainClassAndRun();
@carlo
carlo / google-img-resize.mdown
Last active Nov 7, 2019
Google’s authentication-less on-the-fly image resizing service
View google-img-resize.mdown

Google's authentication-less on-the-fly image resizing service

I found it while poking around the Google+ HTML. Jotting down some notes felt like a good idea, so here goes. If you know more about this API, let me know, please!

(Word of warning: I spent ~30 minutes on both my experimentation and this here write-up, so it might not be the most thought-provoking, brilliant thing you read today.)

@orenitamar
orenitamar / country_codes.json
Created Jul 30, 2012
Two letter country code mapping, grouped by continent/region
View country_codes.json
{
"europe": {
"va": "vatican city",
"ch": "switzerland",
"ad": "andorra",
"ee": "estonia",
"is": "iceland",
"am": "armenia",
"al": "albania",
"cz": "czech republic",
@esperlu
esperlu / mysql2sqlite.sh
Created Apr 27, 2011
MySQL to Sqlite converter
View mysql2sqlite.sh
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
You can’t perform that action at this time.