Skip to content

Instantly share code, notes, and snippets.

@anurupr
anurupr / wine-binfmts
Last active March 6, 2020 15:07
Custom Wine Wrapper Script to handle cl.exe specific usecase for FASTBuild Cross Platform support
package wine
interpreter /usr/bin/winerun
magic MZ
@anurupr
anurupr / ipt.sh
Created September 29, 2019 15:02
script to update iptables for port forwarding over zerotier
#! /bin/bash
IPTABLES=/sbin/iptables
WANIF='<zerotier interface>'
LANIF='<interface which has access to internet>'
ZTIP='<zerotier ip>'
LIP='<ip of $LANIF>'
a_PORTRANGE='<startport>-<endport>'
b_PORTRANGE='<startport>:<endport>'
@anurupr
anurupr / netns.sh
Created September 29, 2019 14:44
using namespaces
# I copied this from another person. I have not been able to find the link. once i do i will link it here.
# i made some modifications - mainly adding variables
# this script causes the zerotier interface to not be accessible by other applications which is why it didn't
# cut it for me
#!/bin/bash
#create netns
sudo service zerotier-one restart
INF='<zerotier interface name>'
IP='<zerotier ip>/24'
# could be wrong here. need more info
@anurupr
anurupr / AiFitToArtboard.jsx
Created August 14, 2019 15:44
Adobe Illustrator script to resize objects proportionally to fit inside the artboard.
/*
Illustrator CS4+ script for resizing objects
proportionally so that they fit inside artboard
Based on: https://forums.adobe.com/message/4164590
Usage:
1. Create new document with desired artboard size
2. Paste object into document, select it and run this script
#target Illustrator
var requiredABsize = 1700; //px
var activeDoc = app.activeDocument;
var abActive = activeDoc.artboards[ activeDoc.artboards.getActiveArtboardIndex() ];
var abProps = getArtboardBounds(abActive);
var scale = findRequiredScale(abProps);
if (scale > 1)
@anurupr
anurupr / youtube-vimeo-url-parser.js
Created August 13, 2019 17:18 — forked from yangshun/youtube-vimeo-url-parser.js
YouTube Vimeo URL Parser
function parseVideo (url) {
// - Supported YouTube URL formats:
// - http://www.youtube.com/watch?v=My2FRPA3Gf8
// - http://youtu.be/My2FRPA3Gf8
// - https://youtube.googleapis.com/v/My2FRPA3Gf8
// - Supported Vimeo URL formats:
// - http://vimeo.com/25451551
// - http://player.vimeo.com/video/25451551
// - Also supports relative URLs:
// - //player.vimeo.com/video/25451551
@anurupr
anurupr / gist:c27b4d7828af9a162a0eaf0d402c8016
Created August 13, 2019 17:18 — forked from ScottCooper92/gist:ea11b690ba4b1278e049
Example of the various YouTube url formats
http://www.youtube.com/watch?v=-wtIMTCHWuI
http://www.youtube.com/v/-wtIMTCHWuI?version=3&autohide=1
http://youtu.be/-wtIMTCHWuI
http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D-wtIMTCHWuI&format=json
http://s.ytimg.com/yt/favicon-wtIMTCHWuI.ico
@anurupr
anurupr / www-post-thumb.php
Created March 28, 2019 13:06 — forked from gmazzap/www-post-thumb.php
WordPress plugin that allow to use an external image url as featured image.
<?php namespace GM\WWWPostThumbnail;
/**
* Plugin Name: WWW Post Thumbnail
* Description: Allow to use an external image url as featured image.
* Plugin URI: https://gist.github.com/Giuseppe-Mazzapica/928bc22e5f49a654cf7c
* Author: Giuseppe Mazzapica
* Author URI: https://github.com/Giuseppe-Mazzapica
* License: MIT
* Version: 0.1.0
*
@anurupr
anurupr / findLongRunningOp.js
Created May 7, 2018 22:00 — forked from kylemclaren/findLongRunningOp.js
Find and (safely) kill long running MongoDB ops
db.currentOp().inprog.forEach(
function(op) {
if(op.secs_running > 5) printjson(op);
}
)