Skip to content

Instantly share code, notes, and snippets.

@amr
amr / find-futex-wait.sh
Created November 30, 2010 18:37
Find processes executing futex with FUTEX_WAIT (helps find deadlock-ed processes)
#!/bin/bash
#
# Find all processes that are executing a futex(2) call with op=FUTEX_WAIT
# In some cases this can be helpful in finding deadlock-ed processes.
#
test ! $UID -eq 0 && echo -e "WARNING: Not running as root, only processes for this user are being scanned\n" >&2;
pids=$(ps -u $UID -opid --no-headers)
for pid in $pids; do
@grenade
grenade / 01-generate-ed25519-ssh-key.sh
Last active June 7, 2024 23:10
generate ed25519 ssh and gpg/pgp keys and set file permissions for ssh keys and config
#!/bin/bash
# generate new personal ed25519 ssh key
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "rob thijssen <rthijssen@gmail.com>"
# generate new host cert authority (host_ca) ed25519 ssh key
# used for signing host keys and creating host certs
ssh-keygen -t ed25519 -f manta_host_ca -C manta.network
eval "$(ssh-agent -s)"
@ax3l
ax3l / CUDA_Compilers.md
Last active June 8, 2024 12:49
CUDA Compilers
@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active May 27, 2024 20:46
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@tuxfight3r
tuxfight3r / 01.bash_shortcuts_v2.md
Last active June 15, 2024 19:41
Bash keyboard shortcuts

Bash Shortcuts

visual cheetsheet

Moving

command description
ctrl + a Goto BEGINNING of command line
@drmalex07
drmalex07 / README-oneshot-systemd-service.md
Last active May 15, 2024 10:52
An example with an oneshot service on systemd. #systemd #systemd.service #oneshot

README

Services declared as oneshot are expected to take some action and exit immediatelly (thus, they are not really services, no running processes remain). A common pattern for these type of service is to be defined by a setup and a teardown action.

Let's create a example foo service that when started creates a file, and when stopped it deletes it.

Define setup/teardown actions

Create executable file /opt/foo/setup-foo.sh:

@ageis
ageis / systemd_service_hardening.md
Last active June 15, 2024 22:41
Options for hardening systemd service units

security and hardening options for systemd service units

A common and reliable pattern in service unit files is thus:

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict
@torch2424
torch2424 / systemDAsUser.service
Last active June 5, 2024 12:28
Run a systemd service as a user
# How to create systemd services: http://neilwebber.com/notes/2016/02/10/making-a-simple-systemd-file-for-raspberry-pi-jessie/
# Digital ocean on a mongodb service: https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04
[Unit]
Description=Run SystemD as users
After=network.target
[Service]
Type=simple
User=[USER HERE]
WorkingDirectory=[USER HOME]
@posener
posener / go-shebang-story.md
Last active March 29, 2024 08:38
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

@tan9
tan9 / ezlearning.user.js
Last active June 13, 2024 01:56
CHT e-Learning Assistant
// ==UserScript==
// @name CHT e-Learning Assistant
// @source https://gist.github.com/tan9/41686eab8e704bb18885a24339010d65
// @version 0.8.7
// @description Learn with no pain (and hopefully not no gain...)
// @author tan9, danny, Ray941216
// @downloadURL https://gist.github.com/tan9/41686eab8e704bb18885a24339010d65/raw/ezlearning.user.js
// @updateURL https://gist.github.com/tan9/41686eab8e704bb18885a24339010d65/raw/ezlearning.user.js
// @require https://www.gstatic.com/firebasejs/4.9.0/firebase.js
// @require https://code.jquery.com/jquery-1.12.4.min.js