Skip to content

Instantly share code, notes, and snippets.

@jdkanani
jdkanani / notepad.html
Last active April 6, 2024 17:09 — forked from jakeonrails/Ruby Notepad Bookmarklet
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">.e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div class="e" id="editor"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("editor");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
<!--
For other language: Instead of `ace/mode/ruby`, Use
Markdown -> `ace/mode/markdown`
Python -> `ace/mode/python`
C/C++ -> `ace/mode/c_cpp`
Javscript -> `ace/mode/javascript`
Java -> `ace/mode/java`
Scala- -> `ace/mode/scala`
@QueuingKoala
QueuingKoala / setup.sh
Last active March 5, 2024 12:15
Sub-CA example
# Assumptions: easyrsa3 available in current dir, and functional openssl.
# This basic example puts the "offline" and "sub" PKI dirs on the same system.
# A real-world setup would use different systems and transport the public components.
# Build root CA:
EASYRSA_PKI=offline ./easyrsa init-pki
EASYRSA_PKI=offline ./easyrsa build-ca nopass
# Build sub-CA request:
EASYRSA_PKI=sub ./easyrsa init-pki
@glacjay
glacjay / tun-ping-win.py
Created September 19, 2010 16:24
Reading/Writing OpenVPN's TUN/TAP Device under Windows using Python.
import _winreg as reg
import win32file
adapter_key = r'SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}'
def get_device_guid():
with reg.OpenKey(reg.HKEY_LOCAL_MACHINE, adapter_key) as adapters:
try:
@endolith
endolith / Readme.txt
Last active September 23, 2023 11:04
Gnome to Wine color scraper
This is a Python script to extract GNOME/GTK's color scheme and apply it to Wine, so that the themes (approximately) match.
Instructions:
1. Set your Gnome theme as you would like it
2. Run with a command like "python wine_colors_from_gtk.py"
3. Restart any apps running in Wine. They should match the Gnome theme colors now.
Better description with screenshots here: http://www.endolith.com/wordpress/2008/08/03/wine-colors/
This is also stored on https://code.launchpad.net/~endolith/+junk/wine-color-scraper
# NOTICE: SSH ACCESS REQUIRED
# INSTALL nano AS AN ALTERNATIVE TO vi
opkg install nano
# PASTE THIS INTO /etc/rc.local BEFORE exit 0
sed -i -e `$i \logger _____Initializing the blocklist... &\n` /etc/rc.local
sed -i -e `$i \wget -O - "http://pgl.yoyo.org/as/serverlist.php?hostformat=dnsmasq&mimetype=plaintext" | sed 's/127.0.0.1/192.168.1.254/g' | grep -vE 'example.com' > /etc/dnsmasq.conf && /etc/init.d/dnsmasq restart &\n` /etc/rc.local
# CREATE /tmp/block.init