Skip to content

Instantly share code, notes, and snippets.

Avatar
🏍️

gianpaolo gianpaolof

🏍️
  • Italy
View GitHub Profile
View README.md

 
Spotify


Everything here is available under the Unlicense!

@gianpaolof
gianpaolof / json_parser.c
Created Oct 14, 2020 — forked from alan-mushi/json_parser.c
Examples for the json-c tutorial.
View json_parser.c
/*
* 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;
@gianpaolof
gianpaolof / update-repo.sh
Last active May 7, 2020 — forked from lalitkale/update-repo.sh
Update Local Repository Folders Recursively
View update-repo.sh
#!/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 / detect_evil_merge.sh
Created May 7, 2020 — 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
View detect_evil_merge.sh
#!/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 / redirectExample.go
Created Apr 2, 2020 — forked from d-schmidt/redirectExample.go
How to redirect HTTP to HTTPS with a golang webserver.
View redirectExample.go
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 {
View gist:7e0fbe3acd2dcc5ce772aa0606a179d2
# Doxyfile 1.8.17
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = Vodafone
PROJECT_NUMBER =
PROJECT_BRIEF =
PROJECT_LOGO =
@gianpaolof
gianpaolof / commit_everything.sh
Last active May 27, 2020 — forked from robballou/commit_everything.sh
A script to commit the git parent repo and any submodule changes too
View commit_everything.sh
#!/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)
View gist:e383d9b378c3faf596dea170590f7664
> 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 / gist:fada9a3fc3fa29fabbe939ca3506b86d
Last active Dec 10, 2019
send/receive json with golang using TLS
View gist:fada9a3fc3fa29fabbe939ca3506b86d
//client
package main
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
"crypto/tls"
)
@gianpaolof
gianpaolof / gist:b181311d13b277d105f8af74576d820a
Created Dec 5, 2019
android emulator with internet connection
View gist:b181311d13b277d105f8af74576d820a
C:\Users\\AppData\Local\Android\Sdk\emulator\emulator.exe -list-avds
Pixel_2_API_25
C:\Users\\AppData\Local\Android\Sdk\emulator\emulator.exe @Pixel_2_API_25 -dns-server 8.8.8.8