Skip to content

Instantly share code, notes, and snippets.

View sy6sy2's full-sized avatar

Sylvain CECCHETTO sy6sy2

  • Cyber-Detect
  • Nancy, France
View GitHub Profile
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@glennklockwood
glennklockwood / openmp-parallel-inner-loop.c
Created April 9, 2015 00:46
Parallelizing only the innermost loop with OpenMP
#include <stdio.h>
#include <time.h>
#include <omp.h>
int main ( void ) {
int i, j;
int me, n;
#pragma omp parallel private(i,j,me,n)
{
@allanortiz
allanortiz / ajax-download-file.js
Created April 11, 2016 20:43
Download file (PDF) with AJAX.
function downloadFile() {
var blob = "";
var xhr = new XMLHttpRequest();
xhr.onload = function(){
if (this.status == 200) {
blob = new Blob([xhr.response], { type: 'application/pdf' });
var link = document.createElement('a');
@DianaEromosele
DianaEromosele / Change "origin" of your GIT repository
Created August 7, 2016 00:31
Change "origin" of your GIT repository
$ git remote rm origin
$ git remote add origin git@github.com:aplikacjainfo/proj1.git
$ git config master.remote origin
$ git config master.merge refs/heads/master
@idleberg
idleberg / sublime-text-macos-context-menu.md
Last active December 25, 2025 16:01 — forked from vincentmac/sublime-text-osx-context-menu.md
“Open in Sublime Text” in macOS context-menu

This list has been updated for Big Sur (and later). Since I don't use these versions, this guide might still need further improvements. For older macOS versions, please see this older revision.

Open in Sublime Text

  • Open Automator
  • Quick Action
  • Set “Service receives selected” to files or folders in any application
  • Add a Run Shell Script action
  • Set the script action to /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n "$@"
  • Set “Pass input” to as arguments
@jgrodziski
jgrodziski / docker-aliases.sh
Last active February 8, 2026 16:30
Useful Docker Aliases
############################################################################
# #
# ------- Useful Docker Aliases -------- #
# #
# # Installation : #
# copy/paste these lines into your .bashrc or .zshrc file or just #
# type the following in your current shell to try it out: #
# wget -O - https://gist.githubusercontent.com/jgrodziski/9ed4a17709baad10dbcd4530b60dfcbb/raw/d84ef1741c59e7ab07fb055a70df1830584c6c18/docker-aliases.sh | bash
# #
# # Usage: #
@bcremer
bcremer / Dockerfile
Created December 12, 2018 20:42
Multi-Stage Dockerfile to prepopulated MySQL Image
## See: https://serverfault.com/a/915845/17736
FROM percona/percona-server:5.7 as builder
USER root
RUN mkdir -p /initialized-db && chown -R mysql:mysql /initialized-db
# That file does the DB initialization but also runs mysql daemon, by removing the last line it will only init
RUN ["sed", "-i", "s/exec \"$@\"/echo \"not running $@\"/", "/docker-entrypoint.sh"]
@claus
claus / _app.js
Created May 14, 2020 05:35
Restore scroll position after navigating via browser back/forward buttons in Next.js
import useScrollRestoration from "utils/hooks/useScrollRestoration";
const App = ({ Component, pageProps, router }) => {
useScrollRestoration(router);
return <Component {...pageProps} />;
};
export default App;
@AntonOfTheWoods
AntonOfTheWoods / ovh_consumer_key.py
Last active January 3, 2025 15:29
Get OVH API consumer key for Let's Encrypt DNS cert-manager certificate issuer provider
# This is a template for getting the famous "consumer key" that you need in order to set up
# Let's Encrypt DNS issuing for your domain via the DNS provider
# See https://medium.com/@gabin.chambon/automatic-certificate-generation-on-kubernetes-with-cert-manager-on-ovh-cloud-a0b58b64279b
# for most details, including the installation of https://github.com/baarde/cert-manager-webhook-ovh.
# This script is useful for the part:
# Then we need to create an OVH API Key , access this URL : And create an API Access with the GET PUT POST DELETE
# right on the /<domain>/zone/* (replace with the domain you want to validate).
# Here are instructions for getting all the credentials you need and configuring this correctly, as it is far from obvious for someone
@degitgitagitya
degitgitagitya / .env
Last active May 10, 2026 10:15
Next JS + Next Auth + Keycloak + AutoRefreshToken
# KEYCLOAK BASE URL
KEYCLOAK_BASE_URL=
# KEYCLOAK CLIENT SECRET
KEYCLOAK_CLIENT_SECRET=
# KEYCLOAK CLIENT ID
KEYCLOAK_CLIENT_ID=
# BASE URL FOR NEXT AUTH