Skip to content

Instantly share code, notes, and snippets.

View gianpaolof's full-sized avatar
🏍️

gianpaolo gianpaolof

🏍️
  • Italy
View GitHub Profile
> I use the following to squash commits
> git reset $(git merge-base master $(git rev-parse --abbrev-ref HEAD))
> git add -A
> git commit -m "feat(...):..."
> git push -f
@gianpaolof
gianpaolof / commit_everything.sh
Last active May 27, 2020 10:02 — forked from robballou/commit_everything.sh
A script to commit the git parent repo and any submodule changes too
#!/bin/bash
#
# Usage: ./commit_everything.sh "Commit message"
BOLD=$(tput bold)
BLACK=$(tput setaf 0)
WHITE=$(tput setaf 7)
BLUE=$(tput setaf 4)
GREEN=$(tput setaf 2)
NORMAL=$(tput sgr0)
# Doxyfile 1.8.17
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = Vodafone
PROJECT_NUMBER =
PROJECT_BRIEF =
PROJECT_LOGO =
@gianpaolof
gianpaolof / redirectExample.go
Created April 2, 2020 11:38 — forked from d-schmidt/redirectExample.go
How to redirect HTTP to HTTPS with a golang webserver.
package main
import (
"net/http"
"log"
)
func redirect(w http.ResponseWriter, req *http.Request) {
// remove/add not default ports from req.Host
target := "https://" + req.Host + req.URL.Path
if len(req.URL.RawQuery) > 0 {
@gianpaolof
gianpaolof / detect_evil_merge.sh
Created May 7, 2020 09:58 — forked from smileyborg/detect_evil_merge.sh
Two scripts that can be used to detect evil merges in Git. See http://stackoverflow.com/questions/27683077
#!/bin/bash
# A shell script to provide a meaningful diff output for a merge commit that can be used to determine whether the merge was evil.
# The script should be run from outside the git repository, with two arguments:
# 1 - the directory of the git repository
# 2 - the SHA for the merge commit to inspect
# The script will output one file:
# - the merge redone fresh without any conflicts resolved, diff'ed to the actual merge
output_file="diff.txt"
@gianpaolof
gianpaolof / update-repo.sh
Last active May 7, 2020 10:06 — forked from lalitkale/update-repo.sh
Update Local Repository Folders Recursively
#!/bin/bash
# Usage:
# ./update_git_repos.sh [parent_directory]
# example usage:
# ./update_git_repos.sh C:/GitProjects/ [MAKE SURE YOU USE / SLASHES]
updateRepo() {
local dir="$1"
local original_dir="$2"
cd $dir # switch to the git repo
@gianpaolof
gianpaolof / json_parser.c
Created October 14, 2020 12:38 — forked from alan-mushi/json_parser.c
Examples for the json-c tutorial.
/*
* A simple example of json string parsing with json-c.
*
* clang -Wall -g -I/usr/include/json-c/ -o json_parser json_parser.c -ljson-c
*/
#include <json.h>
#include <stdio.h>
int main() {
struct json_object *jobj;

 
Spotify

Everything here is available under the Unlicense!

@gianpaolof
gianpaolof / ConnectivityAndInternetAccess.kt
Created April 1, 2022 09:21
Class to check the Connectivity and Internet Access of an Android device.
/*
* Copyright (c) 2014 str4d
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
@gianpaolof
gianpaolof / jenkins-home-git.sh
Created October 26, 2022 12:41 — forked from cenkalti/jenkins-home-git.sh
Backup Jenkins home periodicallly with git.
#!/bin/bash
# Setup
#
# - Create a new Jenkins Job
# - Mark "None" for Source Control Management
# - Select the "Build Periodically" build trigger
# - configure to run as frequently as you like
# - Add a new "Execute Shell" build step
# - Paste the contents of this file as the command