Skip to content

Instantly share code, notes, and snippets.

@ilguzin
ilguzin / mnt_ntfs_macos.sh
Created February 5, 2014 07:11
Mount NTFS for RW under Mac OS
sudo mount_ntfs -o "rw,auto,nobrowse" /dev/disk1s1 /Volumes/portable
@ilguzin
ilguzin / gist:9002014
Last active August 29, 2015 13:56
DKIM + javamail
Check DKIM http://dkimcore.org/c/keycheck
Generate DKIM http://www.socketlabs.com/domainkey-dkim-generation-wizard/
Generate DKIM http://www.port25.com/support/domainkeysdkim-wizard/
openssl pkcs8 -topk8 -nocrypt -in privateKeyDkim.pem -out privateKeyDkim.der -outform der
@ilguzin
ilguzin / tor.rb
Created March 11, 2014 12:42
My TOR brew formula for "force use brewed-openssl"
require 'formula'
class Tor < Formula
homepage 'https://www.torproject.org/'
url 'https://www.torproject.org/dist/tor-0.2.4.21.tar.gz'
sha1 'b93b66e4d5162cefc711cb44f9167ed4799ef990'
devel do
url 'https://www.torproject.org/dist/tor-0.2.5.2-alpha.tar.gz'
version '0.2.5.2-alpha'
wget --no-check-certificate --no-cookies - --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.tar.gz
@ilguzin
ilguzin / get_monitor_type.txt
Created March 26, 2014 11:59
Get macbook pro monitor type
ioreg -lw0 | grep \"EDID\" | sed "/[^<]*</s///" | xxd -p -r | strings -6
@ilguzin
ilguzin / carbon-cache.conf
Created July 13, 2014 21:18
upstart carbon-cache.conf
description "Graphite Carbon Cache Daemon"
start on runlevel [2345]
stop on runlevel [!2345]
expect daemon
respawn
env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
@ilguzin
ilguzin / resolve_auth_before_route.coffee
Created August 14, 2014 09:50
AngularJS. Resolve auth object before routing occurs. Allows to check user authentication before page is shown. The trick is to suppress new value into resolve array for each $routeProvider.when automatically (inside $rootScope.$on "$routeChangeStart")
.run(['$rootScope', '$location', 'Auth', ($rootScope, $location, Auth) ->
$rootScope.$on "$routeChangeStart", (event, next, current) ->
redirectPath = $location.path()
console.debug "Route change started.", next, current, next.access, Auth.isLoggedIn()
_authorize = () ->
if next.access != undefined
@ilguzin
ilguzin / example.html
Last active August 29, 2015 14:05
How to load script inside AngularJS partial. Note [SCRIPT_PATH] in example.html
<script type="text/javascript" data-ng-script-load>
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = '[SCRIPT_PATH]';
document.getElementsByTagName('head')[0].appendChild(script);
</script>
@ilguzin
ilguzin / deny_copy_paste.js
Created October 15, 2014 06:02
Deny copy paste JS
<script type="text/javascript">
document.ondragstart = noselect;
document.onselectstart = noselect;
document.oncontextmenu = noselect;
function noselect() {return false;}
</script>
@ilguzin
ilguzin / color2text_brightness.coffee
Last active August 29, 2015 14:08
Derive text color depending on background brightness
#Color text change
rgb = [
"255"
"0"
"0"
]
setInterval (->
c = "rgb(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + ")"
#http://www.w3.org/TR/AERT#color-contrast