Skip to content

Instantly share code, notes, and snippets.

View porcelli's full-sized avatar

Alex Porcelli porcelli

View GitHub Profile
@porcelli
porcelli / gitremote.properties
Created May 26, 2020 19:20
Code for blog post: Using SSH to push changes to external repository
useSSH=true
@porcelli
porcelli / GitHook.java
Created May 26, 2020 19:10
Code for blog post: How to automatically push every change to an external repository
public class GitHook {
public static void main(String[] args) throws IOException, GitAPIException {
// collect the repository location <1>
final Path currentPath = new File("").toPath().toAbsolutePath();
final String parentFolderName = currentPath.getParent().getName(currentPath.getParent().getNameCount() - 1).toString();
// ignoring system space <2>
if (parentFolderName.equalsIgnoreCase("system")) {
return;
}
@porcelli
porcelli / Person.java
Created May 26, 2020 18:45
Code for blog post: BPMN Extension for VSCode Now Available
package org.acme.kogito.model;
public class Person {
private String name;
private int age;
private boolean adult;
public String getName() {
return name;
@porcelli
porcelli / post-commit-setup.sh
Last active May 26, 2020 19:24
Code for blog post: How to setup post-commit hooks on Business Central
$ mkdir myrepo
$ cd myrepo
$ git init
Initialized empty Git repository in /Users/porcelli/blog/myrepo/.git/
$ touch file1.txt
$ git add .
$ git commit -m "first commit"
[master (root-commit) 0fa1a4a] first commit
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 file1.txt
@fmeyer
fmeyer / thing.js
Last active June 3, 2021 12:06
Unfollow everyone on linkedin
// Go to here https://www.linkedin.com/feed/following/?filterType=connection
// open the chrome dev tools console
// paste the following
// go grab a cup of tea
// get rid of all life coach from linkedin
var buttons = $('button'), interval = setInterval(function() {
var btn = $('.is-following');
console.log('Clicking:', btn);
btn.click();
@usamadar
usamadar / HttpDigestAuthServlet.java
Created June 11, 2012 19:17
HTTP Servlet Sample Implmentation of HTTP Digest Authentication RFC 2617
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.example.http.authenticate;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
@timothyklim
timothyklim / Main.java
Created February 23, 2012 17:48
JGit test with DHT
import org.eclipse.jgit.api.CloneCommand;
import org.eclipse.jgit.api.errors.InvalidRemoteException;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.transport.RemoteConfig;
import org.eclipse.jgit.transport.URIish;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;