Skip to content

Instantly share code, notes, and snippets.

View brianredbeard's full-sized avatar

redbeard brianredbeard

View GitHub Profile
@brianredbeard
brianredbeard / sshpub-to-rsa
Created January 26, 2012 15:16 — forked from thwarted/sshpub-to-rsa
converts an openssh RSA public key into a format usable by openssl rsautl (if you don't have openssh 5.6 or later with ssh-keygen PEM export format)
#!/usr/bin/env python
# with help and inspiration from
# * ASN1_generate_nconf(3) (specifically the SubjectPublicKeyInfo structure)
# * http://www.sysmic.org/dotclear/index.php?post/2010/03/24/Convert-keys-betweens-GnuPG%2C-OpenSsh-and-OpenSSL
# * http://blog.oddbit.com/2011/05/converting-openssh-public-keys.html
import sys
import base64
import struct
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 7, 2024 15:24
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@pvalkone
pvalkone / gist:9292589
Last active October 19, 2021 06:59
How to set up IPMI Serial-Over-LAN (SOL) on a ASRock C2550D4I motherboard and FreeBSD 10.0-RELEASE
BIOS Setup
----------
1) Boot into the BIOS setup utility (press F2 or DEL) and open Advanced > Serial Port Console Redirection.
2) Disable COM1 and EMS console redirection and enable SOL redirection.
3) Set the SOL console redirection settings as follows:
Aptio Setup Utility - Copyright (C) 2012 American Megatrends, Inc.
Advanced
/----------------------------------------------------+-------------------------\
@lukecyca
lukecyca / gist:907c4a62758c068fd464
Last active September 8, 2020 14:44
Impersonating a user with the JIRA API
"""
Example of making a request to JIRA as a trusted application.
In this example, we create a new issue as an arbitrary user.
More information on this technique at:
https://answers.atlassian.com/questions/247528/how-do-you-impersonate-a-user-with-jira-oauth
"""
import oauth2
import time
@sergejmueller
sergejmueller / ttf2woff2.md
Last active March 9, 2024 13:37
WOFF 2.0 – Learn more about the next generation Web Font Format and convert TTF to WOFF2
@plepe
plepe / gist:52ecc9f18efb32c68d18
Last active October 23, 2023 08:50
MDADM and LVM cheat sheet

mdadm

Glossary:

  • md: multiple devices
command description
cat /proc/mdstat show status of all raids
mdadm --detail /dev/md0 detailed status of raid md0
@bhasto
bhasto / Sony Bravia 2014.xml
Last active November 25, 2015 19:35
Plex Profile for Sony Bravia 2014
<?xml version="1.0" encoding="utf-8"?>
<Client name="Sony Bravia 2014">
<Identification>
<Header name="X-AV-Client-Info" regex=".*KDL-\d{2}[WR][5689]\d{2}B.*" />
<DeviceDescription>
<Manufacturer substring="Sony" />
<FriendlyName regex="KDL-\d{2}[WR][5689]\d{2}B.*" />
</DeviceDescription>
</Identification>
<DeviceDescription>
@gubatron
gubatron / compiling_building_c_cpp_notes.md
Last active April 18, 2024 07:58
Things to remember when compiling and linking C/C++ programs

Things to remember when compiling/linking C/C++ software

by Angel Leon. March 17, 2015;

Last update on December 14, 2023

Updated on February 27, 2023

Updated August 29, 2019.

@acdvorak
acdvorak / tmux-all-panes.sh
Last active August 6, 2021 17:09 — forked from yubink/inall.sh
tmux: run a command in all panes
#!/bin/bash
# Runs the specified command (provided by the first argument) in all tmux panes
# in every window. If an application is currently running in a given pane
# (e.g., vim), it is suspended and then resumed so the command can be run.
all-panes()
{
all-panes-bg_ "$1" &
}