Skip to content

Instantly share code, notes, and snippets.

View jcarsique's full-sized avatar

Julien Carsique jcarsique

View GitHub Profile
@jcarsique
jcarsique / gitformat
Last active March 16, 2021 20:40
Git format
#!/bin/bash -e
# Usage: gitformat
# Create a git commit with formatting changes
echo "Ref before changes: $(git id)"
#HEAD=${1:-HEAD}
pushd $(git rev-parse --show-toplevel)
FILES=$(git diff-index --name-only --diff-filter=ad HEAD|xargs)
if [ -z "$FILES" ]; then
echo "No files"
exit 0
(
export NPM_USER=<LdapUsername>
export NPM_PASS=<LdapPassword>
export NPM_EMAIL=<GitHubEmail>
sudo npm install -g npm-cli-adduser
npm config set email $NPM_EMAIL
for repo in $(curl -s -u "$NPM_USER:$NPM_PASS" -X GET "https://mavenin.nuxeo.com/nexus/service/rest/v1/repositories" -H "accept: application/json"|jq -r ' .[] | select(.format == "npm") | .name'); do
[[ $repo == "npm-internal" ]] && continue
echo $repo
npm-cli-adduser -r https://mavenin.nuxeo.com/nexus/repository/$repo/
@jcarsique
jcarsique / Order.java
Created July 6, 2021 08:56
JUnit 4 Test Ordering
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* JUnit 4 equivalent of JUnit 5's {@code org.junit.jupiter.api.Order}
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD })
@jcarsique
jcarsique / .pre-commit-config.yaml
Created December 13, 2021 17:49
pre-commit DEBUG files filtering
# This snippet provides easy debugging of types and files filtering.
# Usage: pre-commit run identity
# pre-commit run identity --all-files
# pre-commit run identity --from-ref origin/HEAD --to-ref HEAD
repos:
- repo: meta
hooks:
- id: identity
name: identity (filtered)
types: [ hcl ]
@jcarsique
jcarsique / aliases
Created January 12, 2024 11:13
Git config
[alias]
ls = "ls-tree --name-only"
ll = "ls-tree -l"
st = status -sb
ci = commit
co = checkout
br = branch
branches = branch -a
glog = log --graph --abbrev-commit --date=relative
mergenff = merge --no-ff