Skip to content

Instantly share code, notes, and snippets.

@Luzifer
Luzifer / README.md
Last active November 18, 2023 17:22
Running docker-compose as a systemd service

Running docker-compose as a systemd service

Files

File Purpose
/etc/compose/docker-compose.yml Compose file describing what to deploy
/etc/systemd/system/docker-compose-reload.service Executing unit to trigger reload on docker-compose.service
/etc/systemd/system/docker-compose-reload.timer Timer unit to plan the reloads
/etc/systemd/system/docker-compose.service Service unit to start and manage docker compose
@AlbertXiebnu
AlbertXiebnu / objectRecog.cc&env=python
Last active January 20, 2021 05:21
tensorflow c++ api to load model and run. from official code base.|-|&tag=gist
#include <fstream>
#include <vector>
#include "tensorflow/cc/ops/const_op.h"
#include "tensorflow/cc/ops/image_ops.h"
#include "tensorflow/cc/ops/standard_ops.h"
#include "tensorflow/core/framework/graph.pb.h"
#include "tensorflow/core/framework/tensor.h"
#include "tensorflow/core/graph/default_device.h"
#include "tensorflow/core/graph/graph_def_builder.h"
@r0l1
r0l1 / confirm.go
Last active November 25, 2023 19:12
Go (golang): How to ask for user confirmation via command line
/* 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:
@lsowen
lsowen / check_sig.go
Last active November 23, 2023 23:31
GPG Signature Verification in go (with golang.org/x/crypto/openpgp)
package main
import (
"fmt"
"golang.org/x/crypto/openpgp"
"os"
)
func main() {
keyRingReader, err := os.Open("signer-pubkey.asc.txt")

Problems & Solutions for Interaction Between C and Go

At Vimeo, on the transcoding team, we work a lot with Go, and a lot with C, for various tasks such as media ingest. This means we use CGO quite extensively, and consequently, have run into bits that are perhaps not very well documented, if at all. Below is my effort to document some of the problems we've run into, and how we fixed or worked around them.

Many of these are obviously wrong in retrospect, but hindsight is 20/20, and these problems do exist in many codebases currently.

Some are definitely ugly, and I much welcome better solutions! Tweet me at @daemon404 if you have any, or have your own CGO story/tips, please! I'd love to learn of them.

Table of Contents

@facelordgists
facelordgists / delete-git-recursively.sh
Created May 13, 2015 05:28
Recursively remove .git folders
( find . -type d -name ".git" && find . -name ".gitignore" && find . -name ".gitmodules" ) | xargs rm -rf
@camoles
camoles / vhosts.go
Last active September 23, 2017 03:41 — forked from JalfResi/revprox.go
Virtual Hosts in Go
package main
import(
"net/url"
"net/http"
"net/http/httputil"
)
func main() {
vhost1, err := url.Parse("http://127.0.0.1:1980")
@reterVision
reterVision / udp_client.go
Created July 12, 2014 07:50
A dummy UDP hole punching sample in Go
package main
import (
"encoding/json"
"fmt"
"log"
"net"
"os"
"time"
)
@mikemaccana
mikemaccana / gist:10847077
Created April 16, 2014 10:13
Tptacek's Review of "Practical Cryptography With Go"

Wow. I've now read the whole book and much of the supporting code. I'm not a fan, and recommend against relying on it. Here's a laundry list of concerns:

  • The teaching method the book uses is badly flawed. The book's strategy is to start simple and build to complexity, which makes sense if you're teaching algebra but not if you're teaching heart surgery. The result is that each chapter culminates with the implementation of a system that is grievously insecure. Little warning is given of this, apart from allusions to future chapters improving the system. For instance, Chapter 2 closes with a chat system that uses AES-CBC without an authenticator.

  • The book is full of idiosyncratic recommendations. For instance, AES-CBC requires a padding scheme. There is a standard padding scheme. The book purports to present it, but instead of PKCS7, it presents 80h+00h..00h.

  • At one point about 1/3rd of the way through the book, it suggests using a SHA256 hash of the plaintext as an authenticator for a message. Thi