Skip to content

Instantly share code, notes, and snippets.

@MichaelCurrin
MichaelCurrin / README.md
Last active April 29, 2024 15:26
Deploy to GitHub Pages with GitHub Actions

GH Pages deploy

Deploys for static sites or web apps made easy with GitHub Actions

A generic but elegant CI flow for deploying a site to Github Pages - this is triggered on a push to master and runs on Github Actions - docs.

This workflow is targeted at a static site like Hexo or a single-page applciation like React project. It doesn't matter what the language is as long as your build steps results in a public directory which can be served on Github Pages.

Show me the workflow

@kaichao
kaichao / log-http-headers.md
Last active May 26, 2024 17:41
nginx: Log complete request/response with all headers

1. switch nginx image to openresty/openresty

2. add the following to server/location (/etc/nginx/conf.d/default.conf)

   set $req_header "";
   set $resp_header "";
   header_filter_by_lua_block{ 
      local h = ngx.req.get_headers();
      for k, v in pairs(h) do
         ngx.var.req_header = ngx.var.req_header .. k.."="..v.." ";
@greymd
greymd / Main.java
Created February 10, 2017 05:14
Prime numbers with Java8 Stream API
import java.util.stream.IntStream;
class Main {
public static void main(String args[]) {
IntStream.rangeClosed(2, 100)
.filter(i -> IntStream.rangeClosed(2, (int)Math.sqrt(i))
.allMatch(j -> i%j != 0))
.forEach(n -> {
System.out.println(n);
});
@dnozay
dnozay / README.md
Last active May 31, 2023 02:12
Collection of useful stuff for interacting with gitlab.

Reset root/admin password

Lost the root/admin password? You can reset it using the command-line. Recipe adapted from gitlab issue #308.

# start the console
sudo gitlab-rails console
@ondrek
ondrek / gist:7413434
Created November 11, 2013 13:48
Smallest Base64 image
data:image/gif;base64,R0lGODlhAQABAAAAACw=