Skip to content

Instantly share code, notes, and snippets.

View iamc's full-sized avatar

Iñigo Aldazabal iamc

  • Materials Physics Center (CFM) - CSIC
  • Donostia - San Sebastian (Spain)
  • 19:19 (UTC +02:00)
View GitHub Profile
@n00rm
n00rm / discord.py
Last active February 5, 2024 09:30
Discord Checkmk Notification Script
#!/usr/bin/env python3
# Notify via Discord
import os
import requests
import sys
USERNAME = "check_mk"
AVATARURL = "https://checkmk.com/favicon-96x96.png"
@fevangelou
fevangelou / Software RAID 1 setup on Ubuntu Server 20.04.md
Last active July 20, 2024 17:15
Software RAID 1 setup on Ubuntu Server 20.04 (or newer)

Looking to create a Software RAID 1 setup for your 2-disk server on Ubuntu Server 20.04?

Screen Shot 2020-06-05 at 20 55 31

Let's start with the basics: the official guide by Ubuntu (https://ubuntu.com/server/docs/install/storage) is outdated/wrong. And as of March 2021 it's possible that there's a bug as well with how the bios_grub partitions are created when using multiple disks.

Now on to the solution:

  • Select "Custom storage layout" when you reach the storage configuration step of the installer.
  • If the disks have existing partitions, click on each disk under AVAILABLE DEVICES and then select REFORMAT. This will (temporarily) wipe out the partitions.
@kalebo
kalebo / Instructions.md
Created October 4, 2017 17:35
Instructions on setting up a FlexLM daemon for SystemD

Setting up a FlexLM service for SystemD

Create directory structure

  1. Create the directory for the flexlm user to use, e.g., /opt/flexlm
  2. Place all the binaries for the licence manager and the licence in a vendor specific subdirectory

At this point you should have something similar to following directory structure:

/opt/flexlm/
└── VENDOR
@cmavr8
cmavr8 / secure-ssh.yml
Last active January 4, 2024 19:52
Secure SSH configuration ansible playbook. Last updated years ago, NOT recommended for use. There are better ways to do this today.
---
# SSH server settings, in line with https://stribika.github.io/2015/01/04/secure-secure-shell.html
# Before using, change myhosts to your hosts' nickname and myuser to your username (two instances! make sure you replace both or you'll be locked out of ssh!)
- hosts: myhosts
become: true
remote_user: myuser
tasks:
# Key exchange, ciphers and MACs
- lineinfile: dest=/etc/ssh/sshd_config regexp='^KexAlgorithms' line='KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256'
@cuibonobo
cuibonobo / centos_python_install.md
Last active April 30, 2024 13:13
Install Python 2.7.15 on CentOS 6

These instructions were mostly taken from here, though I've modified them to install Python 2.7.15 and the latest setuptools package.

# Install dependencies
yum groupinstall -y 'development tools'
yum install -y zlib-devel bzip2-devel openssl-devel xz-libs wget

# Download the Python source and unpack it
wget https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz
tar -xvzf Python-2.7.15.tgz

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@mathse
mathse / gist:09d56d5aa473917d8852
Created February 12, 2015 18:39
check_mk on freenas
## you need to enable tftp under services->tftp
login via ssh
su
cd /usr/local/bin/
mount -uw /
wget -O check_mk_agent "http://git.mathias-kettner.de/git/?p=check_mk.git;a=blob_plain;f=agents/check_mk_agent.freebsd;hb=HEAD"
chmod a+x check_mk_agent
@pescobar
pescobar / gist:451a49b954326d6163f2
Created July 9, 2014 11:44
/etc/profile.d/lmod.sh
shell=`/bin/basename $SHELL`
#shell=`/bin/basename \`/bin/ps -p $$ -ocomm=\``
if [ -f /opt/soft/apps/lmod/lmod/init/$shell ]
then
export PATH=/opt/soft/apps/lua/5.1.4.5/bin:/opt/soft/apps/lmod/lmod/libexec:$PATH
. /opt/soft/apps/lmod/lmod/init/$shell
export MODULEPATH='/opt/Modules/modulesfiles'
for dir in `ls -1 /opt/soft/modules/| egrep -v '^all$' `
do
export MODULEPATH="$MODULEPATH:/opt/soft/modules/$dir"
#!/usr/bin/env zsh
function usage() {
cat <<EOF
USAGE i3-xephyr start|stop|restart|run
start Start nested i3 in xephyr
stop Stop xephyr
restart reload i3 in xephyr
run run command in nested i3
EOF
# This gist is compatible with Ansible 1.x .
# For Ansible 2.x , please check out:
# - https://gist.github.com/dmsimard/cd706de198c85a8255f6
# - https://github.com/n0ts/ansible-human_log
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#