Skip to content

Instantly share code, notes, and snippets.

View purpleidea's full-sized avatar

James purpleidea

View GitHub Profile
@purpleidea
purpleidea / README.md
Created March 5, 2021 01:30 — forked from danbst/README.md
[Linux] [Firefox] Open link in browser, which is in current workspace

I use separate Firefox profiles for work and personal stuff. To distinguish those I place them on different workspaces.

  • Workspace 0: firefox --no-remote -P MyJob
  • Workspace 1: firefox --no-remote -P default

I have also company Slack on Workspace 0. Which usually contains links to some work stuff.

The problem

@purpleidea
purpleidea / frebib.mcl
Created March 2, 2021 17:37
automatic grouping example
# this doesn't work of course...
docker:container "mgmt-nginx" {
volumes => {
"/steve" => struct{type => "volume", source => "steve",},
"/tmp" => struct{type => "tmpfs",},
},
}
# but these three *could* work!
docker:container "mgmt-nginx" {
@purpleidea
purpleidea / main.go
Created February 27, 2021 20:49 — forked from paulzhol/main.go
golang.org/x/sys/unix.Signalfd usage example (Linux)
// +build linux
package main
import (
"flag"
"log"
"os"
"runtime"
"time"
@purpleidea
purpleidea / find
Created February 24, 2021 23:09
ifind
# case insensitive find, eg: ifind <pattern>[ dir1[ dir2[ dirN...]]]
function ifind() {
pat="$1"
shift
if [ "$#" = "0" ]; then
set "."
fi
for d in "$@"; do
#find "$d" -iname "*$pat*" # normal
find "$d" -iname "*$pat*" 2> /dev/null # hide can't read errors
.
├── 11.06-00
│   ├── disk
│   │   ├── deleteOldVersion.sh
│   │   ├── install.csh
│   │   ├── Lib_Utils-1.00-09.noarch.rpm
│   │   ├── Lib_Utils2-1.00-01.noarch.rpm
│   │   ├── LSI-AdapterSASIR.mib
│   │   ├── LSI-AdapterSAS.mib
│   │   ├── MegaCli-8.02.14-1.i386.rpm
# dnf system-upgrade download --refresh --releasever=32
Before you continue ensure that your system is fully upgraded by running "dnf --refresh upgrade". Do you want to continue [y/N]: y
Fedora Modular 32 - x86_64 996 kB/s | 4.9 MB 00:05
Fedora Modular 32 - x86_64 - Updates 992 kB/s | 3.5 MB 00:03
Fedora 32 - x86_64 - Updates 1.0 MB/s | 20 MB 00:19
Fedora 32 - x86_64 972 kB/s | 70 MB 01:13
RPM Fusion for Fedora 32 - Free - Updates 415 kB/s | 590 kB 00:01
RPM Fusion for Fedora 32 - Free 481 kB/s | 679 kB 00:01
RPM Fusion for Fedora 32 - Nonfree - Updates 150 kB/s | 125 kB 00:00
RPM Fusion for Fedora 32 - Nonfree 238 kB/s | 225 kB 00:00
@purpleidea
purpleidea / config.org
Created December 23, 2019 18:41 — forked from dysinger/config.org
My important dotfiles as an org-mode document

Configuration

Setup

git clone \
    https://github.com/chriskempson/base16-shell.git \
// Mgmt
// Copyright (C) 2013-2018+ James Shubin and the project contributors
// Written by James Shubin <[email protected]> and the project contributors
//
// 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.
//
// This program is distributed in the hope that it will be useful,
@purpleidea
purpleidea / filter-golang-stack.py
Created February 22, 2019 15:14
This program filters golang stack traces.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2019+ James Shubin
# Written by James Shubin <[email protected]>
#
# 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.
#
@purpleidea
purpleidea / exit_notify.go
Created February 20, 2019 11:02 — forked from pmalmgren/LICENSE
Go proc connector example, detects when a process exits
package main
import (
"bytes"
"encoding/binary"
"fmt"
"golang.org/x/sys/unix"
"os"
"syscall"
)