Skip to content

Instantly share code, notes, and snippets.

@topjor
topjor / wg.sh
Created February 7, 2019 20:44
Wireguard firmware sustain script
#!/bin/bash -e
BOARD=e300
if [ ! $(dpkg-query --show wireguard) ]; then
tag=$(curl "https://api.github.com/repos/Lochnair/vyatta-wireguard/releases" | jq -r '.[0].tag_name')
deb_url="https://github.com/Lochnair/vyatta-wireguard/releases/download/$tag/wireguard-$BOARD-$tag-1.deb"
curl -L -o "/tmp/wireguard-$BOARD-$tag.deb" "$deb_url"
dpkg -i "/tmp/wireguard-$BOARD-$tag.deb"
rm "/tmp/wireguard-$BOARD-$tag.deb"
source /opt/vyatta/etc/functions/script-template
configure
@mjquinn21
mjquinn21 / Pause Media on AirPods Disconnect.rtf
Last active April 18, 2021 16:17
Applescript to pause media from YouTube and Spotify. Works with Google Chrome for YouTube and Chrome and the desktop client for Spotify. Useful to run with Tooth Fairy to pause music when AirPods are disconnected.
How to Use This Script
1. Open Finder
2. Hit ⌘⇧L (Command + Shift + L)
3. Locate the Scripts folder
4. Move Stop_Media_When_AirPods_Disconnect_For_Tooth_Fairy.scpt to ~/Library/Scripts/
5. Open Tooth Fairy preferences
6. Select your AirPods and click “Advanced”
7. Make sure that “Run shell script after disconnecting” is ticked
8. Paste this in there:
@fahied
fahied / apns
Created March 20, 2016 07:52
How to create APNS Certificates and merge into one PEM
Step 1: Create Certificate .pem from Certificate .p12
Command: openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-cert.p12
Step 2: Create Key .pem from Key .p12
Command : openssl pkcs12 -nocerts -out apns-dev-key.pem -in apns-dev-key.p12
Step 3: Optional (If you want to remove pass phrase asked in second step)
Command : openssl rsa -in apns-dev-key.pem -out apns-dev-key-noenc.pem
Step 4: Now we have to merge the Key .pem and Certificate .pem to get Development .pem needed for Push Notifications in Development Phase of App
@rfunduk
rfunduk / setup-WxH.applescript
Created August 22, 2013 21:27
Example AppleScript for re-arranging commonly used windows for a screen resolution. Eg. switching between laptop at 1440x900 and external monitor at 2560x1440 is a big pain, requiring a lot of moving around and resizing of windows. So instead you adapt this script, make a setup-1440x900.applescript and a setup-2560x1440.applescript, and run them…
tell application "Flint" to activate -- needs to be in front
tell application "System Events" to tell application process "Flint"
try
get properties of window 1
set size of window 1 to {700, 800}
set position of window 1 to {1700, 300}
end try
end tell
tell application "Adium" to activate -- needs to be in front
// kills long running ops in MongoDB (taking seconds as an arg to define "long")
// attempts to be a bit safer than killing all by excluding replication related operations
// and only targeting queries as opposed to commands etc.
killLongRunningOps = function(maxSecsRunning) {
currOp = db.currentOp();
for (oper in currOp.inprog) {
op = currOp.inprog[oper-0];
if (op.secs_running > maxSecsRunning && op.op == "query" && !op.ns.startsWith("local")) {
print("Killing opId: " + op.opid
@sansumbrella
sansumbrella / EventDispatcher.cpp
Created August 3, 2009 07:02
C++ observer pattern for event handling.
#include "EventDispatcher.h"
void EventDispatcher::addListener( Listener *l )
{
mListeners.push_back(l);
}
void EventDispatcher::removeListener( Listener *l )
{
mListeners.erase( std::remove( mListeners.begin(), mListeners.end(), l ), mListeners.end() );
@mskutta
mskutta / EdgeRouter_IPv6_Commands_for_Comcast.txt
Last active December 6, 2023 02:11
EdgeRouter IPv6 Commands for Comcast
configure
# Configure Firewall
set firewall ipv6-name IPV6WAN_IN description 'IPV6WAN to internal'
set firewall ipv6-name IPV6WAN_IN default-action drop
set firewall ipv6-name IPV6WAN_IN rule 10 action accept
set firewall ipv6-name IPV6WAN_IN rule 10 state established enable
set firewall ipv6-name IPV6WAN_IN rule 10 state related enable
set firewall ipv6-name IPV6WAN_IN rule 10 log disable
@filipbec
filipbec / gist:5998034874b119fab0e4
Created September 5, 2014 12:31
Scannr - Keys for obtaining US Driver's license data
@josephsieh
josephsieh / CGImage Rotation.png
Last active January 26, 2024 16:12
Rotate CGImage 90 degree clock wise
CGImage Rotation.png
@chrisboulton
chrisboulton / viscosity-to-ios-connect.rb
Last active March 21, 2024 00:59
Quickly convert all of your Viscosity connections into OVPN configuration files for OpenVPN for iOS (bundles certificates and keys in the files too)
config_files = Dir.glob("#{ENV['HOME']}/Library/Application Support/Viscosity/OpenVPN/*/config.conf")
config_files.each do |file|
certificate_files = ['ca', 'cert', 'key', 'tls-auth']
config_dir = File.dirname(file)
connection_name = nil
new_config = []
File.read(file).each do |line|
line.strip!