Skip to content

Instantly share code, notes, and snippets.

View guillermo-menjivar's full-sized avatar

gmo guillermo-menjivar

View GitHub Profile
@maxkostinevich
maxkostinevich / dev.yml
Last active March 12, 2024 17:18
Github Actions - Deploy Serverless Framework (AWS)
#
# Github Actions for Serverless Framework
#
# Create AWS_KEY and AWS_SECRET secrets in Github repository settings
# If you're using env.yml file, store its content as ENV Github secret
#
# Master branch will be deployed as DEV and every new tag starting with "v**" (e.g. v1.0, v1.2, v2.0, etc) will be deployed as PROD
#
# Learn more: https://maxkostinevich.com/blog/how-to-deploy-serverless-applications-using-github-actions/
#
@smford22
smford22 / main.tf
Created May 21, 2018 19:15
terraform GCP remote exec
/*
This is a test server definition for GCE+Terraform for GH-9564
*/
provider "google" {
project = "${var.project}" // Your project ID here.
region = "${var.region}"
}
resource "google_compute_firewall" "gh-9564-firewall-externalssh" {
@olivere
olivere / elastic_v6_getting_started.go
Created March 1, 2018 07:27
Getting started with Elastic v6
package main
import (
"context"
"encoding/json"
"fmt"
"reflect"
"github.com/olivere/elastic"
)
@joyrexus
joyrexus / README.md
Last active February 24, 2024 15:16
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")

Kafka installation with systemd

0. Create kafka user

sudo adduser kafka
sudo adduser kafka sudo
su -l kafka

1. Download and Install kafka archive

We use hipchat to post messages out of hipchat. One thing we noticed is that we were consistently getting an error even though messages were posting correctly.
After a little research, we found that we were getting back a 204 from the api call. A 204 indicates that the request has been fulfilled and that there is no additional content to send in the response payload body - https://httpstatuses.com/204.
In our case, this is a valid return for this type of traffic - so looking at the hipchat.py script in modules, you can see that a false is purposefully being returned when no content is returned:
if result.get('status', None) == salt.ext.six.moves.http_client.OK:
response = hipchat_functions.get(api_version).get(function).get('response')
return result.get('dict', {}).get(response, None)
elif result.get('status', None) == salt.ext.six.moves.http_client.NO_CONTENT:
@sdieunidou
sdieunidou / rabbitmq.txt
Created October 22, 2015 19:51
create admin user on rabbitmq
rabbitmqctl add_user test test
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
@mdwhatcott
mdwhatcott / custom_json.go
Created July 29, 2015 17:15
Example of implementing MarshalJSON and UnmarshalJSON to serialize and deserialize custom types to JSON in Go. Playground: http://play.golang.org/p/7nk5ZEbVLw
package main
import (
"bytes"
"encoding/json"
"fmt"
"strconv"
)
func main() {
@simeji
simeji / descrive_ec2_instances.go
Last active May 29, 2023 20:09
Get EC2 instance list filtered by NameTag
package main
import (
"fmt"
"github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/aws-sdk-go/aws/credentials"
"github.com/awslabs/aws-sdk-go/service/ec2"
)
func main() {
@Kartones
Kartones / postgres-cheatsheet.md
Last active March 27, 2024 12:38
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)