Skip to content

Instantly share code, notes, and snippets.

@JamesCullum
JamesCullum / untag-old-gitlab-images.py
Last active March 18, 2024 15:37
Gitlab doesn't have a functionality to automatically untag old images (https://gitlab.com/gitlab-org/gitlab-ce/issues/25322). You can use this script to do that for you using the API from any host with HTTP connection (doesn't require access to the server via SSH). Please be aware that you will need a separate cronjob to purge all untagged images.
#!/usr/bin/env python3
'''
DEVELOPMENT SPONSORED BY
PANASONIC INFORMATION SYSTEMS COMPANY EUROPE
Interested in a job? Apply below:
https://application.job.panasonic.eu/data/ruP0pHQvHrGZJKvL/rc.php?nav=jobsearch&custval12=ite&lang=EN&custval11=PBSEU_GER
'''
@dpino
dpino / snakecoin-server-full-code.py
Last active January 4, 2019 03:19 — forked from aunyks/snakecoin-server-full-code.py
The code in this gist isn't as succinct as I'd like it to be. Please bare with me and ask plenty of questions that you may have about it.
#!/usr/bin/env python
# Source https://gist.github.com/aunyks/47d157f8bc7d1829a729c2a6a919c173
# Modifications:
# - Can pass port number as command line argument.
# - Added GET method /add_peer.
# - On retrieving blockchain, call consensus to synchronize with other peers.
# - On updating the current blockchain from a peers' blockchain, convert list
# of JSON blocks to native Block objects.
@auckenox
auckenox / move_packages.sh
Last active June 15, 2020 16:12
[PLEASE DO NOT USE THIS SCRIPT ANYMORE] Synology move packages to another volume
#!/bin/bash
# ######################################################################################################
## WARNING: THIS SCRIPT HAS THE POTENTIAL TO HARM YOUR DSM ON CURRENT VERSIONS OF DSM! DO NOT USE IT
# ######################################################################################################
# this script moves ALL packages from volume-x to volume-y
# For Synology DSM - tested with DSM6.1
# change these values
from_vol="volume1"
@thedaviddias
thedaviddias / Preload CSS - Not blocking CSS.html
Last active February 1, 2024 08:24
Preload CSS and don't block the DOM with your CSS file request.
<link rel="preload" href="css/global.min.css" as="style" onload="this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="css/global.min.css"></noscript>
<script>
/*! loadCSS. [c]2017 Filament Group, Inc. MIT License */
!function(a){"use strict";var b=function(b,c,d){function j(a){if(e.body)return a();setTimeout(function(){j(a)})}function l(){f.addEventListener&&f.removeEventListener("load",l),f.media=d||"all"}var g,e=a.document,f=e.createElement("link");if(c)g=c;else{var h=(e.body||e.getElementsByTagName("head")[0]).childNodes;g=h[h.length-1]}var i=e.styleSheets;f.rel="stylesheet",f.href=b,f.media="only x",j(function(){g.parentNode.insertBefore(f,c?g:g.nextSibling)});var k=function(a){for(var b=f.href,c=i.length;c--;)if(i[c].href===b)return a();setTimeout(function(){k(a)})};return f.addEventListener&&f.addEventListener("load",l),f.onloadcssdefined=k,k(l),f};"undefined"!=typeof exports?exports.loadCSS=b:a.loadCSS=b}("undefined"!=typeof global?global:this);
/*! loadCSS rel=preload po
@inadarei
inadarei / minikube-sierra.md
Last active October 20, 2020 01:57
Minikube Setup: Docker for Mac / Sierra

Prerequisite: latest Docker for Mac on MacOS Sierra

$ brew update
$ brew install --HEAD xhyve
$ brew install docker-machine-driver-xhyve
$ sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
$ sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve

$ curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.18.0/minikube-darwin-amd64 &amp;&amp; chmod +x minikube &amp;&amp; sudo mv minikube /usr/local/bin/
@kevin-smets
kevin-smets / 1_kubernetes_on_macOS.md
Last active May 5, 2024 10:12
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
@bostjanpisler
bostjanpisler / moment.pipe.ts
Created January 24, 2016 12:59
angular 2 moment pipe
import {Pipe, PipeTransform} from 'angular2/core';
import * as moment from 'moment';
/*
* Time helper using momentjs
* Usage:
* timestamp | moment:'DD.MM.YYYY'
* Defaults to 'L' - locale ie. '01/24/2016'
*/
@kevinansfield
kevinansfield / video.rb
Created May 20, 2015 16:12
Refile attachment with ZenCoder processing
# == Schema Information
#
# Table name: videos
#
# id :integer not null, primary key
# meta_info :jsonb default({}), not null, indexed
# created_at :datetime not null
# updated_at :datetime not null
# videoable_id :integer indexed => [videoable_type]
# videoable_type :string indexed => [videoable_id]
@consti
consti / missing_indices.sql
Created May 13, 2015 07:11
Find missing indices in postgres
SELECT relname, seq_scan-idx_scan AS too_much_seq, case when seq_scan-idx_scan>0 THEN 'Missing Index?' ELSE 'OK' END, pg_relation_size(relname::regclass) AS rel_size, seq_scan, idx_scan
FROM pg_stat_all_tables
WHERE schemaname='public' AND pg_relation_size(relname::regclass)>80000 ORDER BY too_much_seq DESC;