Skip to content

Instantly share code, notes, and snippets.

James purpleidea

Block or report user

Report or block purpleidea

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View sysctl.go
// Mgmt
// Copyright (C) 2013-2018+ James Shubin and the project contributors
// Written by James Shubin <james@shubin.ca> 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 Feb 22, 2019
This program filters golang stack traces.
View filter-golang-stack.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2019+ James Shubin
# Written by James Shubin <james@shubin.ca>
#
# 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 Feb 20, 2019 — forked from pmalmgren/exit_notify.go
Go proc connector example, detects when a process exits
View exit_notify.go
package main
import (
"bytes"
"encoding/binary"
"fmt"
"golang.org/x/sys/unix"
"os"
"syscall"
)
@purpleidea
purpleidea / 1-output.txt
Created Jan 23, 2019 — forked from jordansissel/1-output.txt
Convert curl|bash to an rpm with Docker and FPM
View 1-output.txt
% docker build -t rust .
...
# Export the image to tarball, which itself contains tarballs and a manifest.json
% docker save -o rust.tar rust
# Extract the last layer
# tar's -O flag extracts a single entry from the tarball.
# The file we want is the last "Layer" in the manifest.json
% tar -xf rust.tar -O $(tar -xf rust.tar -O manifest.json | jq -r '.[].Layers[-1]') > curlbash.tar
@purpleidea
purpleidea / copy.go
Created Dec 13, 2018 — forked from r0l1/copy.go
Copy a directory tree (preserving permissions) in Go.
View copy.go
/* MIT License
*
* Copyright (c) 2017 Roland Singer [roland.singer@desertbit.com]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@purpleidea
purpleidea / readme.md
Created Nov 27, 2018 — forked from dominictarr/readme.md
statement on event-stream compromise
View readme.md

Hey everyone - this is not just a one off thing, there are likely to be many other modules in your dependency trees that are now a burden to their authors. I didn't create this code for altruistic motivations, I created it for fun. I was learning, and learning is fun. I gave it away because it was easy to do so, and because sharing helps learning too. I think most of the small modules on npm were created for reasons like this. However, that was a long time ago. I've since moved on from this module and moved on from that thing too and in the process of moving on from that as well. I've written way better modules than this, the internet just hasn't fully caught up.

@broros

otherwise why would he hand over a popular package to a stranger?

If it's not fun anymore, you get literally nothing from maintaining a popular package.

One time, I was working as a dishwasher in a restu

@purpleidea
purpleidea / capslock_super_esc.md
Created Nov 18, 2018 — forked from bendavis78/capslock_super_esc.md
Mapping Caps Lock to simultaneous Esc and Super (Mod4)
View capslock_super_esc.md

Mapping Caps Lock to simultaneous Esc and Super (Mod4)

The CAPS key can be mapped to an escape key when pressed once, and a super (mod4) key when used in combination with other keys.

Create the file /usr/share/X11/xkb/symbols/custom_opts with the following:

// Make Caps an additional Escape
hidden partial modifier_keys
xkb_symbols "super_esc" {
    key <CAPS> { [ Escape ] };
View freeze.md

Freezer cgroup FTW

In a terminal start a server.

$ python -m SimpleHTTPServer 8000

In another terminal set up the cgroups freezer.

@purpleidea
purpleidea / SMBDIS.ASM
Created Jun 30, 2018 — forked from 1wErt3r/SMBDIS.ASM
A Comprehensive Super Mario Bros. Disassembly
View SMBDIS.ASM
;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY
;by doppelganger (doppelheathen@gmail.com)
;This file is provided for your own use as-is. It will require the character rom data
;and an iNES file header to get it to work.
;There are so many people I have to thank for this, that taking all the credit for
;myself would be an unforgivable act of arrogance. Without their help this would
;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into
;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no
View Hyperlinks_in_Terminal_Emulators.md
You can’t perform that action at this time.