Skip to content

Instantly share code, notes, and snippets.

Avatar

Jean-Christophe jcberthon

View GitHub Profile
@jcberthon
jcberthon / ESO-EELT-CentOS-74.repo
Created Nov 7, 2019
ESO repository for EELT Linux DevEnv
View ESO-EELT-CentOS-74.repo
[ESO-EELT-CentOS-74]
name=ESO repository for EELT Linux DevEnv
baseurl=ftp://ftp.eso.org/pub/eelt/EELTREPO/CentOS-74
enabled=1
gpgcheck=0
metadata_expire=1m
View gist:143c3e6b7c9e5fc8f18c9204ca1bedf6
$ sudo docker-containerd-ctr pprof --debug-socket /run/docker/containerd/docker-containerd-debug.sock goroutines
goroutine 1916106 [running]:
runtime/pprof.writeGoroutineStacks(0x55e3880d1be0, 0xc420200540, 0x0, 0x0)
	/usr/local/go/src/runtime/pprof/pprof.go:608 +0xa9
runtime/pprof.writeGoroutine(0x55e3880d1be0, 0xc420200540, 0x2, 0x30, 0x55e387c98c00)
	/usr/local/go/src/runtime/pprof/pprof.go:597 +0x46
runtime/pprof.(*Profile).WriteTo(0x55e3880bd6c0, 0x55e3880d1be0, 0xc420200540, 0x2, 0xc420200540, 0xc42035e9c0)
	/usr/local/go/src/runtime/pprof/pprof.go:310 +0x3ad
net/http/pprof.handler.ServeHTTP(0xc42011c6d1, 0x9, 0x55e3880dc720, 0xc420200540, 0xc42019ff00)
@jcberthon
jcberthon / update-docker-compose.sh
Last active Jan 28, 2020
Downloading and installing/updating latest Docker Compose (command line)
View update-docker-compose.sh
#!/bin/bash
# Copyright 2017-2018 Jean-Christophe Berthon
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@jcberthon
jcberthon / Readme.md
Created Nov 8, 2016
Leap second testing
View Readme.md

Source: https://access.redhat.com/articles/199563

This program will insert an actual leap second and may cause issues on unpatched systems. It is strongly recommended to use this in a test environment.

Build

gcc leap-a-day.c -o leap-a-day -lrt

Usage

@jcberthon
jcberthon / networkmanager-wifi-powersave.md
Last active Feb 12, 2021
NetworkManager Wi-Fi powersaving configuration
View networkmanager-wifi-powersave.md

NetworkManager WiFi Power Saving

NetworkManager supports WiFi powersaving but the function is rather undocumented.

From the source code: wifi.powersave can have the following value:

  • NM_SETTING_WIRELESS_POWERSAVE_DEFAULT (0): use the default value
  • NM_SETTING_WIRELESS_POWERSAVE_IGNORE (1): don't touch existing setting
  • NM_SETTING_WIRELESS_POWERSAVE_DISABLE (2): disable powersave
@jcberthon
jcberthon / ssh-fingerprint
Created Sep 29, 2016
Print a known host public key fingerprint
View ssh-fingerprint
# The examples below are given with the hostname github.com.
# Just change the hostname to one of your known hosts.
# These commands are particularly usefull if your ~/.ssh/known_hosts file is
# hashed!
# To display the fingerprint in its default form
ssh-keygen -l -F github.com
# To choose the algorithm for displaying the fingerprint (valid option for OpenSSH 7.2 are: `md5` or `sha256`)
ssh-keygen -l -E sha256 -F github.com
@jcberthon
jcberthon / docker-img-gc
Last active Sep 11, 2017 — forked from anildigital/gist:862675ec1b7bccabc311
Remove dangling docker images and volumes
View docker-img-gc
docker images --quiet --filter=dangling=true | xargs --no-run-if-empty docker rmi
@jcberthon
jcberthon / mount.sh
Created Feb 17, 2013
I have found this shell script on http://pastebin.com/DYUBe7dK looks interesting!
View mount.sh
#!/usr/bin/env bash
# call with `mount.sh true` for debug messages
home_vols=( "/Volumes/NFS_mount" ) # if more than one mountpoint then order is important
home_router_mac="0:23:46:9d:e:f7" # use code below to identify this data
mounts=( `mount | grep /Volumes | awk {'print$3'}` )
router_ip=`netstat -rnf inet | grep default | awk {'print$2'}`
router_mac=`netstat -rnf inet | grep -v link | grep -w ^$router_ip | awk {'print$2'}`
#echo $router_mac #for current router's MAC address
@jcberthon
jcberthon / init_end_boot_script
Created Jul 20, 2012
Simple init script that is launch at the end of the boot process (example) for openSUSE or Fedora (compatible with systemd)
View init_end_boot_script
#!/bin/sh
### BEGIN INIT INFO
# Provides: nothing
# Required-Start: $all
# Default-Start: 3 5
# Default-Stop: 4
# Short-Description: single_line_description
# Description: multiline_description
### END INIT INFO
@jcberthon
jcberthon / report_duplicate.rb
Created Jun 21, 2012
Return the duplicated elements of an enumerable (e.g. array) in Ruby
View report_duplicate.rb
# Source: http://www.dzone.com/snippets/identify-duplicates-array
module Enumerable
# Returns any duplicates entry if found
# Usage: <enumerable>.report_duplicate
def report_duplicate
inject({}) {|h,v| h[v]=h[v].to_i+1; h}.reject{|k,v| v==1}.keys
end
end