Skip to content

Instantly share code, notes, and snippets.

@ahmetb
ahmetb / gcrgc.sh
Last active March 10, 2025 21:51
Script to clean up Google Container Registry images pushed before a particular date
#!/bin/bash
# Copyright © 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@cyrille-leclerc
cyrille-leclerc / pipeline.groovy
Last active March 9, 2022 23:41
Escape character & quotes in Jenkins Pipeline
docker.image('cloudbees/java-build-tools:0.0.6').inside {
sshagent(['github-ssh-credentials']) {
sh """
git version
git config --local user.email \\"[email protected]\\"
git config --local user.name \\"Cyrille Le Clerc\\"
git clone [email protected]:cyrille-leclerc/a-test-repo.git
date &> now.txt
@kwk
kwk / Makefile
Last active March 14, 2025 08:43
Compiling with Address Sanitizer (ASAN) with CLANG and with GCC-4.8
.PHONY: using-gcc using-gcc-static using-clang
using-gcc:
g++-4.8 -o main-gcc -lasan -O -g -fsanitize=address -fno-omit-frame-pointer main.cpp && \
ASAN_OPTIONS=symbolize=1 ASAN_SYMBOLIZER_PATH=$(shell which llvm-symbolizer) ./main-gcc
using-gcc-static:
g++-4.8 -o main-gcc-static -static-libstdc++ -static-libasan -O -g -fsanitize=address -fno-omit-frame-pointer main.cpp && \
ASAN_OPTIONS=symbolize=1 ASAN_SYMBOLIZER_PATH=$(shell which llvm-symbolizer) ./main-gcc-static
@ymartin59
ymartin59 / IterableListScrollableResults.java
Created April 1, 2014 13:42
IterableListScrollableResults<E> is a partial wrapper view as a List<E> on an Hibernate ScrollableResults. When an existing code process a large amount of Hibernate entities as a List<E>, it allows to work with data in stream without a large code refactoring.
import java.util.AbstractList;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.NoSuchElementException;
import org.hibernate.ScrollableResults;
import org.hibernate.Session;
/**
* A List<E> partial wrapper view on an Hibernate ScrollableResults.
@pregress
pregress / gist:7657656
Created November 26, 2013 12:37
ParseResharperCLI CodeActivity
[BuildActivity(HostEnvironmentOption.All)]
public sealed class ParseResharperCLI : CodeActivity
{
// Define an activity input argument of type string
public InArgument<string> PathToXml { get; set; }
public OutArgument<string[]> Warnings { get; set; }
public OutArgument<string[]> Errors { get; set; }
// If your activity returns a value, derive from CodeActivity<TResult>
// and return the value from the Execute method.
@xconnecting
xconnecting / build.gradle
Created November 29, 2012 01:25
Gradle: Using jdbc in build script
import groovy.sql.Sql
apply plugin: 'groovy'
apply plugin: 'eclipse'
apply plugin: 'maven'
repositories { mavenCentral() }
configurations { driver }
dependencies { driver 'org.xerial:sqlite-jdbc:3.7.2' }
curl -XPUT localhost:9200/test -d '
{"settings": {
"analysis" :{
"analyzer": {
"exact_analyzer": {
"type": "custom",
"tokenizer":"my_pattern_tokenizer",
"filter":[]
}
},