Top HN posts
<?php | |
// half-hearted CSS minification | |
$css = preg_replace( | |
array('/\s*(\w)\s*{\s*/','/\s*(\S*:)(\s*)([^;]*)(\s|\n)*;(\n|\s)*/','/\n/','/\s*}\s*/'), | |
array('$1{ ','$1$3;',"",'} '), | |
file_get_contents('linked.css') | |
); | |
// embed as a data: uri | |
$base64css = rtrim(strtr(base64_encode($css), '+/', '-_'), '='); |
# study stream aliases | |
# Requires https://github.com/caarlos0/timer to be installed. spd-say should ship with your distro | |
declare -A pomo_options | |
pomo_options["work"]="45" | |
pomo_options["break"]="10" | |
pomodoro () { | |
if [ -n "$1" -a -n "${pomo_options["$1"]}" ]; then | |
val=$1 |
n=256;q, t, m, e, p, c, f=(range(n),16,lambda x | |
,y, r=0:m((h:=x <<1,h^283)[ | |
h&n!= 0],y>> 1,(r,r ^x) | |
[y&1])if y else r,lambda | |
a,w= 1,p=n -2:e(m(a, a),(w,m | |
(w,a))[p&1] ,p>> 1)if p | |
else w, lambda b: list( | |
map (print,["%.2x "*t%(*b[r:r+t],)for | |
r in [*q][::t]])),lambda a,i: (a<<i|a>>8-i)&255 | |
,lambda a: (a^c(a,1)^c(a,2)^c(a,3)^c(a,4))^99); |
# I'll be doing another one for Linux, but this one will give you | |
# a pop up notification and sound alert (using the built-in sounds for macOS) | |
# Requires https://github.com/caarlos0/timer to be installed | |
# Mac setup for pomo | |
alias work="timer 60m && terminal-notifier -message 'Pomodoro'\ | |
-title 'Work Timer is up! Take a Break 😊'\ | |
-appIcon '~/Pictures/pumpkin.png'\ | |
-sound Crystal" |
' Proof of Concept: retrieving SSN for syscalling in VBA | |
' Author: Juan Manuel Fernandez (@TheXC3LL) | |
'Based on: | |
'https://www.mdsec.co.uk/2020/12/bypassing-user-mode-hooks-and-direct-invocation-of-system-calls-for-red-teams/ | |
'https://www.crummie5.club/freshycalls/ | |
Private Type LARGE_INTEGER |
# The mystery around secpxxxk1 generation points :) | |
# ------------------------------------------------- | |
# | |
# The SEC 2 familiy of elliptic curves are defined in https://www.secg.org/sec2-v2.pdf | |
# and widely used in cryptography. | |
# | |
# The generation points G of these curves are defined in the standard paper without any nearer | |
# explanation how they were chosen. Interestingly the generation points (G) of all prime order | |
# koblitz curves of the SEC 2 family (secp160k1, secp192k1, secp224k1, secp256k1) share some | |
# unusual mysterious property. |
In the olden days, HTML was prepared by the server, and JavaScript was little more than a garnish, considered by some to have a soapy taste.
After a fashion, it was decided that sometimes our HTML is best rendered by JavaScript, running in a user's browser. While some would decry this new-found intimacy, the age of interactivity had begun.
But all was not right in the world. Somewhere along the way, we had slipped. Our pages went uncrawled by Bing, time to first meaningful paint grew faster than npm, and it became clear: something must be done.
And so it was decided that the applications first forged for the browser would also run on the server. We would render our HTML using the same logic on the server and the browser, and reap the advantages of both worlds. In a confusing series of events a name for this approach was agreed upon: Server-side rendering. What could go wrong?
In dark rooms, in hushed tones, we speak of colours.
#!/bin/bash | |
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont' |