Skip to content

Instantly share code, notes, and snippets.

View SwagDevOps's full-sized avatar

Dimitri Arrigoni SwagDevOps

  • Colmar, France
  • 02:23 (UTC +01:00)
View GitHub Profile
@noraj
noraj / 01-mini-netstat.rb
Last active March 2, 2023 22:29
netstat -ta4 or ss -ta4 equivalent in Ruby and Crystal
require 'etc'
TCP_STATES = { # /usr/src/linux/include/net/tcp_states.h
'00': 'UNKNOWN',
'FF': 'UNKNOWN',
'01': 'ESTABLISHED',
'02': 'SYN_SENT',
'03': 'SYN_RECV',
'04': 'FIN_WAIT1',
'05': 'FIN_WAIT2',
@markusfisch
markusfisch / README.md
Last active October 19, 2025 11:04
Render some Markdown file to HTML and show it in your browser

Preview Markdown files locally

Render some Markdown file to HTML and show it in your browser.

This is useful when you want to check a Markdown file before pushing it onto GitHub/GitLab/etc or if you want to simply print a nice looking Markdown file. Just print it from your browser.

The look is broadly similar to that on GitHub but stripped down to the bare minimum. It can also be changed easily. Just have a look at the

@tarnagas
tarnagas / ush.sh
Created July 9, 2019 08:59
Unsecure (S)SH
#!/usr/bin/env sh
ssh -o UserKnownHostsFile=/dev/null \
-o StrictHostKeyChecking=no \
-o LogLevel=ERROR \
$@
@zoilomora
zoilomora / README.md
Last active April 20, 2025 20:46
How to disable systemd-resolved in Ubuntu

How to disable systemd-resolved in Ubuntu

Stages

  • Disable and stop the systemd-resolved service:

      sudo systemctl disable systemd-resolved.service
      sudo systemctl stop systemd-resolved
    
  • Then put the following line in the [main] section of your /etc/NetworkManager/NetworkManager.conf:

@eliav-lavi
eliav-lavi / prepend_wrapper.rb
Created October 16, 2018 07:26
Wrapping methods with prepend
module FooWrapper
def bar
puts "this will happen before the real bar!"
super
end
end
class Foo
prepend FooWrapper
@hazcod
hazcod / logger.go
Last active September 22, 2021 14:27
Simple logger that listens for UNIX datagram message and prints them to stdout. We don't like syslog-ng in our postfix container!
package main
import (
"bufio"
"net"
"os"
"syscall"
)
func println(msg string) {
@Brainiarc7
Brainiarc7 / C-states.md
Created July 14, 2018 00:20 — forked from wmealing/C-states.md
What are CPU "C-states" and how to disable them if needed?

To limit a CPU to a certain C-state, you can pass the processor.max_cstate=X option in the kernel line of /boot/grub/grub.conf.

Here we limit the system to only C-State 1:

    kernel /vmlinuz-2.6.18-371.1.2.el5 ... processor.max_cstate=1

On some systems, the kernel can override the BIOS setting, and the parameter intel_idle.max_cstate=0 may be required to ensure sleep states are not entered:

#!/bin/bash
# Trap sigterm and sleep before passing signal to child for $SIGNAL_TIMEOUT seconds
# this is to address a shutdown issue with traefik: https://docs.traefik.io/user-guide/marathon/#shutdown
cmd=${*}
# default to 10 seconds
SIGNAL_TIMEOUT=${SIGNAL_TIMEOUT:-10}
log() {
@bagder
bagder / trrprefs.md
Last active May 31, 2025 00:43
This once held TRR prefs. Now it has moved.

NOTE

This content has moved.

Please go to bagder/TRRprefs for the current incarnation of the docs, and please help us out polish and maintain this documentation!

@leodutra
leodutra / etc-default-grub
Last active September 28, 2020 16:33
Grub Config + Fix NVIDIA Freezes
GRUB_DEFAULT=0
# !!! GRUB_HIDDEN_TIMEOUT requires GRUB_TIMEOUT=0
#GRUB_TIMEOUT=5
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR="Arch"
# !!! add "intel_pstate=disable" to CMDLINE_LINUX_DEFAULT for no CPU sleeps (when NVidia freezes, bad drivers)
# !!! blacklisting nouveau for better proprietary handling
GRUB_CMDLINE_LINUX_DEFAULT="nouveau.blacklist=1 quiet sysrq_always_enabled=1"
GRUB_CMDLINE_LINUX=""