Skip to content

Instantly share code, notes, and snippets.

View mika's full-sized avatar

Michael Prokop mika

View GitHub Profile
@mika
mika / how-to-upgrade-nvmw-ssd-firmware-on-linux.md
Created October 8, 2018 06:16 — forked from klingtnet/how-to-upgrade-nvmw-ssd-firmware-on-linux.md
How to upgrade [Lenovo] NVMe SSD firmware on Linux

The instructions were tested on a Lenovo X1 Carbon 5th Gen (X1C5) on Arch Linux but should be applicable to other Lenovo models and Linux distributions.

BACKUP YOUR DATA! I created a bootable Ubuntu Image like this:

$ sudo sh -c 'curl --location --silent --fail "http://releases.ubuntu.com/18.04/ubuntu-18.04.1-desktop-amd64.iso" | pv > /dev/<your-usb-drive>'
# note that pv is only there to show progress, it is perfectly fine to redirect curl to the usb drive directly.

then I booted from this drive by pressing F12 on reboot and dumped my NVMe disk to an external hard drive like this:

port=0
interface=enp8s0
bind-interfaces
dhcp-range=192.168.0.50,192.168.0.150,12h
enable-tftp
dhcp-match=set:efi-x86_64,option:client-arch,7
dhcp-boot=tag:efi-x86_64,grubx64.efi
tftp-root=/tmp/tftpboot
#!/usr/bin/make -f
CRTS := $(wildcard *.crt)
PEMS := $(shell echo $(CRTS) | sed 's,\.crt,.pem,g')
OCSPS := $(shell echo $(CRTS) | sed 's,\.crt,.ocsp,g')
DHS := $(shell echo $(CRTS) | sed 's,\.crt,.dh,g')
all: $(PEMS) $(OCSPS) $(DHS)
chmod 600 *.key
@mika
mika / main.yml
Created January 4, 2018 23:52 — forked from stefan2904/main.yml
My update role, inspired by nicoo. (roles/update/tasks/main.yml)
---
- name: apt update/upgrade
apt:
autoclean: yes
update_cache: yes
upgrade: "{{ upgrade|default('safe') }}"
- name: Install ansible module dependencies
apt:
@mika
mika / gist:f6626f7810a7c75cae02b498cd4a411b
Created December 29, 2017 15:48 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@mika
mika / get_alexa_1m_mx_rrs
Created September 6, 2017 08:55 — forked from azet/get_alexa_1m_mx_rrs
Retrieves MX and A records for 'Alexa Top 1 Million' hosts and prints them as pretty formatted JSON objects to stdout.
#!/usr/bin/env bash
#
# Retrieves MX and A records for 'Alexa Top 1 Million' hosts
# and prints them as pretty formatted JSON objects to stdout.
#
# *Optional* parallelism support with GNU Parallel (recommended):
# $ sudo apt-get install parallel
#
# Authors: Aaron Zauner <azet@azet.org>
# License: CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0)
@mika
mika / prometheus-apt.pl
Created September 6, 2017 08:54 — forked from Grauwolf/prometheus-apt.pl
prometheus-apt
#!/usr/bin/perl
# generates output for prometheus-node-exporter textfile collector
# run as cronjob. eg.
# 0 * * * * root /usr/local/bin/prometheus-apt > /var/lib/prometheus-textfile/prometheus-apt.prom
use strict;
use warnings;
use feature 'say';
@mika
mika / gist:c2a0df79f9fcf59c96f99adb9d3eac83
Created August 11, 2017 08:14 — forked from benwalton/gist:1777718
Clean up emails in the queue. usage ./postfix-delete.pl email@example.com
#!/usr/bin/perl
$REGEXP = shift || die "no email-adress given (regexp-style, e.g. bl.*\@yahoo.com)!";
@data = qx</usr/sbin/postqueue -p>;
for (@data) {
if (/^(\w+)(\*|\!)?\s/) {
$queue_id = $1;
}
if($queue_id) {
@mika
mika / hb_all_books_dl.js
Created August 8, 2017 12:19 — forked from graymouser/hb_all_books_dl.js
Humble bundle book bundles - download all books at once
/*
After purchasing a humble book bundle, go to your download page for that bundle.
Open a console window for the page and paste in the below javascript
*/
$('a').each(function(i){
if ($.trim($(this).text()) == 'MOBI') {
$('body').append('<iframe id="dl_iframe_'+i+'" style="display:none;">');
document.getElementById('dl_iframe_'+i).src = $(this).data('web');
}
});
printf "[Service]\nSystemCallFilter=~fsync sync syncfs fdatasync msync sync_file_range\nSystemCallErrorNumber=0\n" \
| s env EDITOR='tee -a' systemctl edit postgresql@.service