Skip to content

Instantly share code, notes, and snippets.

View cescoferraro's full-sized avatar
🏠
Working from home

cesco cescoferraro

🏠
Working from home
View GitHub Profile
@thilinapiy
thilinapiy / mongo-statefulset.yaml
Created October 27, 2017 12:21
MongoDB statefulset for kubernetes with authentication and replication
## Generate a key
# openssl rand -base64 741 > mongodb-keyfile
## Create k8s secrets
# kubectl create secret generic mongo-key --from-file=mongodb-keyfile
---
apiVersion: v1
kind: Service
metadata:
name: mongo
labels:
@r0l1
r0l1 / confirm.go
Last active June 9, 2024 04:38
Go (golang): How to ask for user confirmation via command line
/* MIT License
*
* Copyright (c) 2017 Roland Singer [[email protected]]
*
* 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:
@zamicol
zamicol / gox typical build with output directory
Created March 29, 2016 23:01
How to build to an output directory with gox for golang
gox -output="bin/{{.Dir}}_{{.OS}}_{{.Arch}}" -os="linux windows"
@forabi
forabi / Webpack 2.0.7-beta vs Rollup
Last active August 20, 2024 13:14
Webpack 2 vs Rollup
❯ rollup --version
rollup version 0.25.3
❯ time rollup -c ./rollup.js
rollup -c ./rollup.js 4.65s user 0.22s system 118% cpu 4.131 total
❯ time webpack
Hash: ebb00bbccd954c114d3c
Version: webpack 2.0.7-beta
Time: 3623ms
package main
import (
"fmt"
"io"
"os"
)
var path = "/Users/novalagung/Documents/temp/test.txt"
@ladyjer
ladyjer / zizag.css
Created September 13, 2015 14:04
CSS to display a zigzag profile on top and bottom of an HTML element. Class 'zigzag'
.zigzag::after {
content:'';
display:block;
height:10px;
background:repeating-linear-gradient(
-45deg,
transparent ,
transparent 50%,
#006ab7 50%,
#006ab7
@cescoferraro
cescoferraro / __init__.py
Last active August 29, 2015 14:21 — forked from anonymous/__init__.py
Flask (with factory_app) + Celery integration
# Empty
@domenic
domenic / 0-github-actions.md
Last active May 26, 2024 07:43
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with GitHub Actions

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:

  • It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
  • It is free, with no quotas.
  • Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.
@daryltucker
daryltucker / flask.py
Last active October 12, 2023 13:31
Really disable logger logging in Flask
# I have my own logging setup and had a hard time disabling console output in Flask.
app.logger.disabled = True
log = logging.getLogger('werkzeug')
log.disabled = True
# New, 2022 Method:
logging.getLogger('werkzeug').disabled = True
@soheilhy
soheilhy / nginxproxy.md
Last active October 23, 2024 08:19
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers