Skip to content

Instantly share code, notes, and snippets.

View tsdtsdtsd's full-sized avatar

Orkan Alat tsdtsdtsd

View GitHub Profile
@paragonie-scott
paragonie-scott / crypto-fails.md
Last active March 26, 2017 14:04
Don't use the OWASP PHP Crypto Library
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@dmitshur
dmitshur / main.go
Last active September 6, 2017 08:32
Server for HTTP protocol. Redirects all requests to HTTPS.
// Server for HTTP protocol. Redirects all requests to HTTPS.
package main
import (
"flag"
"log"
"net/http"
)
var (
@dmitshur
dmitshur / main.go
Last active January 28, 2018 08:48
Server for HTTPS protocol. Redirects to canonical hosts, reverse proxies requests to internal backing servers.
// Server for HTTPS protocol. Redirects to canonical hosts, reverse proxies requests to internal backing servers.
package main
import (
"crypto/tls"
"flag"
"log"
"net/http"
"net/http/httputil"
"time"
@noelboss
noelboss / git-deployment.md
Last active August 12, 2025 18:16
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

func (b *backend) handle(c1 *tls.Conn, c *net.TCPConn) {
c2, err := net.DialTCP("tcp", nil, b.addr)
if err != nil {
c1.Close()
return
}
go func() {
err := io.Copy(c2, c1)
if err != nil {
log.Print(err)
// Copyright 2016 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// Command caption reads an audio file and outputs the transcript for it.
package main
import (
"fmt"
"io"
@r0l1
r0l1 / copy.go
Last active August 3, 2025 11:39
Copy a directory tree (preserving permissions) in Go.
/* MIT License
*
* Copyright (c) 2017 Roland Singer [roland.singer@desertbit.com]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@Ovid
Ovid / newton.go
Last active December 21, 2016 16:28
Newton's methods for calculating the square root in golang
package main
// newton's method for calculating square roots
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
@jesselucas
jesselucas / changroup.go
Last active November 20, 2024 20:23
Simple solution for using a WaitGroup with select{}
package main
import (
"fmt"
"sync"
"time"
)
func main() {
// Create a wait group of any size