Skip to content

Instantly share code, notes, and snippets.

@akorobov
akorobov / no-itunes.sh
Last active December 17, 2015 10:29
Prevent iTunes from launching when using pause/plain/next/prev keysThis works in OS X 10.8.4+
sudo cp /System/Library/CoreServices/rcd.app/Contents/MacOS/rcd /System/Library/CoreServices/rcd.app/Contents/MacOS/rcd.orig
# make sure replace with equal number of spaces(we're patching executable binary)
sudo perl -pi -e 's#tell application id "com.apple.iTunes" to launch# #g' /System/Library/CoreServices/rcd.app/Contents/MacOS/rcd
# sign new binary
sudo codesign -f -s - /System/Library/CoreServices/rcd.app/Contents/MacOS/rcd
# restart
killall -9 rcd
@akorobov
akorobov / PkiUtils.java
Created October 9, 2013 23:46
Example of reading and writing x509 certificate and RSA private keys encoded in PEM format using BouncyCastle 1.48 (new api)
public class PkiUtils {
public static final int MinPassPhraseLength = 4;
public static List<?> readPemObjects(InputStream is, final String pphrase)
throws IOException {
List<Object> list = new LinkedList<Object>();
PEMParser pr2 = new PEMParser(new InputStreamReader(is));
JcaPEMKeyConverter converter = new JcaPEMKeyConverter().setProvider("BC");
JcaX509CertificateConverter certconv = new JcaX509CertificateConverter().setProvider("BC");
@akorobov
akorobov / ipv6-httpd.py
Created December 11, 2013 00:58
quick ipv6 http server using python's SimpleHttpServer
import socket
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
class MyHandler(SimpleHTTPRequestHandler):
def do_GET(self):
if self.path == '/ip':
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
@akorobov
akorobov / reinit-sound.sh
Created March 15, 2014 17:54
Fix(audio subsystem reinitialization) for no sound in osx 10.9(.2?) after sleep with headphones in
sudo kextunload /System/Library/Extensions/AppleHDA.kext
sudo kextload /System/Library/Extensions/AppleHDA.kext
sudo killall -9 coreaudiod

Keybase proof

I hereby claim:

  • I am akorobov on github.
  • I am akorobov (https://keybase.io/akorobov) on keybase.
  • I have a public key whose fingerprint is C507 2F37 C7A6 D970 C9E6 C0A3 AAD0 3E1A 6C26 B71F

To claim this, I am signing this object:

@akorobov
akorobov / emacs-25.2-term-24bit-colors.diff
Last active March 20, 2018 10:16
Patch for emacs 25.2 (rc2) to enable 24-bit colors in terminal
diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi
index f7a47f8..e9cfe7a 100644
--- a/doc/misc/efaq.texi
+++ b/doc/misc/efaq.texi
@@ -1491,6 +1491,39 @@ exhibits all the colors Emacs knows about on the current display.
Syntax highlighting is on by default since version 22.1.
+Emacs 26.1 and later support direct color mode in terminals. If Emacs
+finds Terminfo capabilities @samp{setb24} and @samp{setf24}, 24-bit
@akorobov
akorobov / rustup-install.md
Created March 19, 2017 19:15
Installing rustup in different location

To install rustup in different directory (i.e. /opt):

  1. install rustup in custom directory pointed to by RUSTUP_HOME envvar:
curl https://sh.rustup.rs -sSf | sudo RUSTUP_HOME=/opt/rustup sh -s -- -y
  1. select default tool chain