Skip to content

Instantly share code, notes, and snippets.

View tsdtsdtsd's full-sized avatar

Orkan Alat tsdtsdtsd

View GitHub Profile
@tsdtsdtsd
tsdtsdtsd / app.js
Last active August 29, 2015 14:19
Starting peter - proof of concept
var prompt = require('prompt');
var config = require('config');
var peter = require('./peter.js');
if(!config.has('app.promptSchema') || !config.has('app.google') || !config.has('peter')) {
throw "Error: Check your config.";
}
prompt.start();

Generated private key

openssl genrsa -out server.key 2048

To generate a certificate

openssl req -new -x509 -key server.key -out server.pem -days 3650

https

@tsdtsdtsd
tsdtsdtsd / etc-init.d-hello-world
Created September 27, 2016 09:10 — forked from josephspurrier/etc-init.d-hello-world
/etc/init.d Script for Go Application
#!/bin/bash
#
# chkconfig: 35 95 05
# description: Hello world application.
# Run at startup: sudo chkconfig hello-world on
# Load functions from library
. /etc/init.d/functions
@tsdtsdtsd
tsdtsdtsd / _.sh
Created January 2, 2017 21:12 — forked from ikennaokpala/_.sh
Starting up and Monitoring a Golang binary in production
# Make it executable
sudo chmod +x etc/init.d/myapp
# Try it:
sudo service myapp start
# Make it run upon boot:
sudo update-rc.d myapp defaults
@tsdtsdtsd
tsdtsdtsd / .gitlab-ci-golang-glide.yml
Last active June 7, 2017 10:47
Config for building a golang 1.8 application with glide vendoring on gitlab-ci
image: golang:1.8-alpine # The alpine builds are much smaller but lack tools we need, we'll add them later
stages:
- build
- test
before_script:
- apk --update --upgrade add git curl-dev openssh curl ca-certificates # This is how we add system dependencies.
# You may need less or more packages for your app.
- curl -sS https://glide.sh/get | sh
- mkdir -p /go/src/gitlab.com/
@tsdtsdtsd
tsdtsdtsd / guess.go
Created July 26, 2017 08:33 — forked from akhenakh/guess.go
Guess an image format in Golang
package main
import (
"image"
_ "image/gif"
_ "image/jpeg"
_ "image/png"
"io"
"mime"
@tsdtsdtsd
tsdtsdtsd / signal.go
Created November 25, 2017 11:41 — forked from reiki4040/signal.go
signal handling example for golang
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
)
func main() {
@tsdtsdtsd
tsdtsdtsd / gist:15d36079d45c30ff6992acc13563c2b4
Last active July 9, 2022 18:10
go tool doesn't exclude _ folder
go version
# Tested with:
# go version go1.17.6 linux/amd64
# go version go1.18.3 linux/amd64
pwd
# /tmp/go-test
go mod init example.com/user/go-test
# go: creating new go.mod: module example.com/user/go-test