Skip to content

Instantly share code, notes, and snippets.

@miguelmota
miguelmota / cmd.go
Created Oct 7, 2018
Golang cobra example
View cmd.go
package cmd
import (
"log"
"os"
server "github.com/org/app/server"
"github.com/spf13/cobra"
)
@drandarov-io
drandarov-io / D.R.Y. - Reuse Gradle repository definition
Last active May 28, 2019
D.R.Y. - Reuse Gradle repository definition
View D.R.Y. - Reuse Gradle repository definition
This works however:
#### build.gradle
```gradle
buildscript {
// Repository Configuration
ext.repos = {
mavenCentral()
maven { url 'https://repo.spring.io/milestone' }
@h4cc
h4cc / Makefile
Last active Jul 11, 2021
Ubuntu 18.04 Bionic Beaver - Basic packages i usually install
View Makefile
#
# Ubuntu 18.04 (Bionic Beaver)
#
# Basic packages i usually install.
#
# Author: Julius Beckmann <github@h4cc.de>
#
# Upgraded Script from 17.04: https://gist.github.com/h4cc/09b7fe843bb737c8039ac62d831f244e
# Upgraded Script from 16.04: https://gist.github.com/h4cc/fe48ed9d85bfff3008704919062f5c9b
@tomcatzh
tomcatzh / readwrite.go
Created Apr 1, 2015
Golang readline and writeline
View readwrite.go
func readLines(path string) ([]string, error) {
file, err := os.Open(path)
if err != nil {
return nil, err
}
defer file.Close()
var lines []string
scanner := bufio.NewScanner(file)
for scanner.Scan() {
@docwhat
docwhat / example1
Created Dec 7, 2015
choco install dotnet3.5 fails (but succeeds?)
View example1
PS C:\Users\Administrator> choco install dotnet3.5 -debug -yes
Chocolatey is running on Windows v 6.3.9600.0
Attempting to delete file "C:/ProgramData/chocolatey/choco.exe.old".
Attempting to delete file "C:\ProgramData\chocolatey\choco.exe.old".
Command line: "C:\ProgramData\chocolatey\choco.exe" install dotnet3.5 -debug -yes
Received arguments: install dotnet3.5 -debug -yes
NOTE: Hiding sensitive configuration data! Please double and triple
check to be sure no sensitive data is shown, especially if copying
output to a gist for review.
@romaninsh
romaninsh / lambda-vpc-internet-access-cloudformation.yml
Last active Dec 22, 2021
CloudFormation template implementing Private network which can be used by Serverless to deploy Lambda into VPCs an maintaining internet access
View lambda-vpc-internet-access-cloudformation.yml
# Add the following to your existing VPC CF stack
# create 2 subnets, lambdas like to be in multiple subnets
Private1:
Type: AWS::EC2::Subnet
Properties:
VpcId: !Ref VPC
AvailabilityZone: !Select [ 0, !GetAZs ]
CidrBlock: !Ref Private1CIDR
@madevelopers
madevelopers / readzip.go
Created Jan 29, 2015
golang: Read zip file
View readzip.go
package main
import (
"archive/zip"
"fmt"
"io/ioutil"
)
type myCloser interface {
Close() error
@matthewpalmer
matthewpalmer / pod.yaml
Last active Mar 7, 2022
Example Kubernetes pod for the multi-container sidecar design pattern
View pod.yaml
# Example YAML configuration for the sidecar pattern.
# It defines a main application container which writes
# the current date to a log file every five seconds.
# The sidecar container is nginx serving that log file.
# (In practice, your sidecar is likely to be a log collection
# container that uploads to external storage.)
# To run:
@espaciomore
espaciomore / watch.sh
Last active Apr 5, 2022
Watch command for Git Bash
View watch.sh
#!/bin/bash
ARGS="${@}"
clear;
while(true); do
OUTPUT=`$ARGS`
clear
echo -e "${OUTPUT[@]}"
done
@schacon
schacon / gist:942899
Created Apr 26, 2011
delete all remote branches that have already been merged into master
View gist:942899
$ git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
xargs -L1 |
awk '{split($0,a,"/"); print a[2]}' |
xargs git push origin --delete