Skip to content

Instantly share code, notes, and snippets.

@kpsherva
kpsherva / flat-shadow.less
Last active June 2, 2023 17:14
Creates nice flat type shadows on text or icons
.flat-text-shadow-mixin(@color: @brandColor, @shadowLength: 80, @opacity: 19, @direction: 5.5) {
// possible directions, by angles
// 0 - bottom, 1 - bottom right, 1.57 - right, 2 - top right, 3.15 - top, 4 - top left, 4.72 left, 5.5 - left bottom
text-shadow+: 0 0 0 rgb(@color);
each(range(@shadowLength),
{
// fade out the shade on each step, multiplying by coefficient
@_color: darken(@color, @opacity/@shadowLength * (@shadowLength - @value));
// set the fade coefficient on the coordinates of the shadow
@fade: @value * @shadowLength / 100;

Force RGB mode in Mac OS X to fix the picture quality of an external monitor (Original)

Update: I have heard that 10.8.3 has solved this problem for some people, so I rolled back my changes and installed the update. No change on my monitor. Nevertheless, it’d be a good idea to update OS X before trying this, since it may fix the issues with your particular hardware.

I recently bought a MacBook Pro (with ‘Retina’ screen), but when I hooked it up to my Dell U2410 monitor via HDMI cable I was shocked by the poor picture quality. The contrast was all wrong and text was misshapen. No amount of calibration in the monitor or software would fix it.

Short answer: OS X thinks my monitor is a TV, and is using the YCbCr colour space rather than RGB. I had to override an EDID setting to force the RGB colour space, and it is now working correctly.

Long answer: I haven’t owned a Mac for a while and h

@kpsherva
kpsherva / tcpdump-es-capture-MacOs
Last active November 2, 2018 13:50 — forked from z0mbix/tcpdump-es-capture
Capture Elasticsearch Queries
# tcpdump -A -nn -s 0 'tcp dst port 9200 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' -i lo0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on lo, link-type EN10MB (Ethernet), capture size 65535 bytes
14:32:33.525122 IP 127.0.0.1.49777 > 127.0.0.1.9200: Flags [P.], seq 313752908:313753888, ack 2465010394, win 257, options [nop,nop,TS val 2684167067 ecr 2684167066], length 980
E...^.@.@............q#...}L...............
..#...#.GET /index/_search HTTP/1.1
Host: 127.0.0.1:9200
Accept: */*
Content-Length: 845
Content-Type: application/x-www-form-urlencoded