Skip to content

Instantly share code, notes, and snippets.

View epelc's full-sized avatar

Ed Pelc epelc

View GitHub Profile
@epelc
epelc / override-host.go
Created April 18, 2020 04:01
Override http.Client host to ip address or separate host
// Override http.Client host to ip address or separate host
// Basically a programic equivalent of `/etc/hosts` in go for http clients
package main
import (
"context"
"fmt"
"io/ioutil"
"net"
"net/http"
@epelc
epelc / cleanup-images.md
Last active October 17, 2019 15:14
Delete Gitlab Registry Images

Soft-delete the images

Generate a script to delete all images using the following. Copy paste into chrome console on the registry page of a project.

NOTE you must update the textToSave template string before running.

// Options(fill these out with your info)

// GITLAB_INSTANCE is the url to your custom instance or `gitlab.com`
const GITLAB_INSTANCE = 'gitlab.yourwebsite.com'
const GROUP = 'yourGroup'
@epelc
epelc / your_test.go
Created February 10, 2016 03:56
Use pflags and regular `go test` flags in your tests
package yourpackage
import (
goflag "flag"
"fmt"
"os"
"strings"
"testing"
flag "github.com/spf13/pflag"
@epelc
epelc / vineScrape.go
Last active August 29, 2015 14:28 — forked from cryptix/vineScrape.go
extract a javascript object value from a html page using goquery and otto
package main
import (
"errors"
"log"
"os"
"github.com/PuerkitoBio/goquery"
"github.com/robertkrimen/otto"
)
@epelc
epelc / select.scss
Created January 16, 2015 15:20
Angular-material select styles
select {
max-width: 195px;
transition: border 0.15s cubic-bezier(0.35, 0, 0.25, 1);
border: 0px;
border-bottom: 1px solid #e0e0e0;
&:focus {
border-bottom: 2px solid #yourPrimaryColor;
}
}
@epelc
epelc / gist:6aa345f4496776569830
Created January 6, 2015 21:13
Angular-material: Sidebar and content full height example
<!DOCTYPE html>
<html ng-app="your-app" lang="en">
<head>
<!-- imports title appcache etc -->
</head>
<body layout="column">
<div layout="row" ng-controller="menuCtrl" flex>
<md-sidenav layout="column" class="md-sidenav-left md-whiteframe-z2" md-component-id="left" md-is-locked-open="$media('gt-lg')">
@epelc
epelc / colorGen.js
Last active August 29, 2015 14:11
Generate material design color palette from a base color
var bases = [{
alpha: 0.13,
name: "50"
}, {
alpha: 0.31,
name: "100"
}, {
alpha: 0.50,
name: "200"
}, {