Skip to content

Instantly share code, notes, and snippets.

@JMBattista
JMBattista / install_gradle
Last active April 24, 2018 17:31
Upgrade Gradle Codeship
#!/bin/bash
# Allows using different Gradle versions with http://codeship.io
#
# As @altfatterz points out below this isn't necessary if you choose to check in your .gradle and gradlew.bat/gradlew.sh files.
# I prefer not to check-in the generated files so I set this up.
#
# We update the path here instead of via the environment variables because you cannot control the order
# that environment variables are set in the Environment tab, and this results in the path NOT having the version number
# see test_commands for info on how to run gradle without settings the path here if you want to avoid it.
#
@grafjo
grafjo / build.gradle
Created October 31, 2014 14:17
Example gradle build to upload a Spring Boot based jar to nexus
group = "foo"
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.8.RELEASE")
}
}
@nl5887
nl5887 / transfer.fish
Last active March 22, 2022 09:07
Bash and zsh alias for transfer.sh. Transfers files and directories to transfer.sh.
function transfer
if test (count $argv) -eq 0
echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"
return 1
end
## get temporarily filename, output is written to this file show progress can be showed
set tmpfile ( mktemp -t transferXXX )
## upload stdin or file
@heatxsink
heatxsink / glog-example.go
Last active March 25, 2023 06:02
An example of how to use golang/glog.
/*
glog-example
------------
background
---
You probably want to read the source code comments at the top of the glog.go file in
the golang/glog repository on github.com. Located here: https://github.com/golang/glog/blob/master/glog.go
setup
@stephen-mw
stephen-mw / list_ec2_instances.md
Last active April 18, 2022 16:07
List running EC2 instances with golang and aws-sdk-go

This is the beginning of hopefully many new posts with golang snippets from my blog. List all of your running (or pending) EC2 instances with Amazon's golang sdk.

For a list of filters or instance attributes consult the official documentation.

package main

import (
	"fmt"
	"github.com/awslabs/aws-sdk-go/aws"
@hudon
hudon / docker-log-truncate
Last active November 9, 2016 06:06
Automatically truncate docker logs on a coreos machine
cat > /var/tmp/log-truncate <<EOF
#!/bin/sh
set -eux
cd /var/lib/docker/containers
for id in *
do
logfile="\${id}/\${id}-json.log"
[ -e "\${logfile}" ] && truncate -s 0 "\${logfile}"
done
btrfs balance start -v -dusage=20 /var/lib/docker/btrfs
@stephen-mw
stephen-mw / ec2list.go
Last active December 14, 2017 01:38
Ec2 list in go
package main
import (
"fmt"
"github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/aws-sdk-go/service/ec2"
"github.com/vaughan0/go-ini"
"net/url"
"os"
"runtime"
@sighingnow
sighingnow / Makefile
Last active April 28, 2024 10:42
Detect operating system in Makefile.
# Detect operating system in Makefile.
# Author: He Tao
# Date: 2015-05-30
OSFLAG :=
ifeq ($(OS),Windows_NT)
OSFLAG += -D WIN32
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
OSFLAG += -D AMD64
endif
@uupaa
uupaa / image.resize.in.github.flavored.markdown.md
Last active May 27, 2024 21:45
image resize in github flavored markdown.

Image source

https://gyazo.com/eb5c5741b6a9a16c692170a41a49c858.png

Try resize it!

  • ![](https://gyazo.com/eb5c5741b6a9a16c692170a41a49c858.png | width=100)
@samkeen
samkeen / ec2-instance-subnet-id.md
Last active January 23, 2024 17:07
Get the subnet and VPC id of a running EC2 instance

First get the Interface mac address, then use that to run the full command

INTERFACE=$(curl --silent http://169.254.169.254/latest/meta-data/network/interfaces/macs/)
SUBNET_ID=$(curl --silent http://169.254.169.254/latest/meta-data/network/interfaces/macs/${INTERFACE}/subnet-id)
VPC_ID=$(curl --silent http://169.254.169.254/latest/meta-data/network/interfaces/macs/${INTERFACE}/vpc-id)

echo SUBNET_ID