Skip to content

Instantly share code, notes, and snippets.

@AlexKobachiJP
AlexKobachiJP / EditMode.swift
Last active February 15, 2024 05:24
Reimplementation of SwiftUI EditMode enum for macOS
// Documentation comments are copied from the official documentation for iOS.
import SwiftUI
#if os(macOS)
/// Reimplemenation of [EditMode](https://developer.apple.com/documentation/swiftui/editmode) for macOS.
public enum EditMode {
/// The user can edit the view content.
@pnc
pnc / observer.md
Last active September 9, 2023 23:32
Using Erlang observer/appmon remotely

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host
@rothgar
rothgar / install-tmux
Last active April 5, 2023 06:53 — forked from ekiara/how_to_install_tmux_on_centos
Install tmux 1.9 on rhel/centos 6
# Install tmux on Centos release 6.5
# install deps
yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
curl -OL https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar -xvzf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=/usr/local
@gburd
gburd / async_nif.h
Last active October 3, 2023 05:12
Technique for running Erlang NIFs functions asynchronously, not on scheduler threads.
/*
* async_nif: An async thread-pool layer for Erlang's NIF API
*
* Copyright (c) 2012 Basho Technologies, Inc. All Rights Reserved.
* Author: Gregory Burd <greg@basho.com> <greg@burd.me>
*
* This file is provided to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 2, 2024 11:04
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@baoshan
baoshan / install-pypy.sh
Created April 24, 2012 11:23
Install PyPy on CentOS
# yum list \*openssl\*
yum install -y openssl098e
yum install -y zlib
ln -s /usr/lib64/libssl.so.0.9.8e /usr/lib64/libssl.so.0.9.8
ln -s /usr/lib64/libcrypto.so.0.9.8e /usr/lib64/libcrypto.so.0.9.8
ln -s /lib64/libbz2.so.1 /lib64/libbz2.so.1.0
wget https://bitbucket.org/pypy/pypy/downloads/pypy-1.8-linux64.tar.bz2
tar -xf pypy-1.8-linux64.tar.bz2
cp -r pypy-1.8 /opt
ln -s /opt/pypy-1.8/bin/pypy /usr/local/bin
@brantfaircloth
brantfaircloth / paths_to_full_paths.py
Created September 30, 2011 00:27
Convert paths to full paths (argparse)
class FullPaths(argparse.Action):
"""Expand user- and relative-paths"""
def __call__(self, parser, namespace, values, option_string=None):
setattr(namespace, self.dest, os.path.abspath(os.path.expanduser(values)))
def get_args():
parser = argparse.ArgumentParser(description='Something smart here')
parser.add_argument('my_conf', help='The configuration file for the db', action = FullPaths)
return parser.parse_args()