Skip to content

Instantly share code, notes, and snippets.

View juliocesar's full-sized avatar

Julio Cesar Ody juliocesar

View GitHub Profile
@juliocesar
juliocesar / calc-sapisidhash.js
Created May 11, 2023 17:02 — forked from eyecatchup/calc-sapisidhash.js
Calculate SAPISIDHASH
async function getSApiSidHash(SAPISID, origin) {
function sha1(str) {
return window.crypto.subtle.digest("SHA-1", new TextEncoder("utf-8").encode(str)).then(buf => {
return Array.prototype.map.call(new Uint8Array(buf), x=>(('00'+x.toString(16)).slice(-2))).join('');
});
}
const TIMESTAMP_MS = Date.now();
const digest = await sha1(`${TIMESTAMP_MS} ${SAPISID} ${origin}`);
@juliocesar
juliocesar / nazis.md
Created November 21, 2019 01:53
nazis_rise_to_power

(Source)

Sort of, but not quite.

NSDAP (the Nazi Party) won a plurality of seats in the Reichstag (Parliament), but was unable to form a majority government because the Communists won the second-greatest number of seats, and while neither party won a majority, they collectively won enough seats for neither one to be able to muster enough support from the other parties to form a working majority.

I don't remember the exact details (I'm sure someone else can elaborate), but basically the Nazis did their best to paralyze the government. Eventually, there was an alleged terrorist attack (actually staged by the Nazis themselves) that convinced (independent) President Hindenburg to name Hitler as "Chancellor" in exchange for the Nazis agreeing to form a coalition government with other parties. At the time, Chancellor was a largely symbolic and ceremonial role.

The Nazis then did what would, in computer security terms, be classified as a complex m

@juliocesar
juliocesar / color.scss
Last active August 3, 2016 05:45
Color palette implementation in Sass
// Color scale function
// ====================
//
// Similarly to dirg, this assists with creating rhythmic colour
// variations from a palette. The definition of the $color-palette var
// is made at build time.
// Granularity of variations.
$step-size: 7.5% !default;
@juliocesar
juliocesar / gist:ebb658162370d2482d5520ea7a8581c7
Created June 8, 2016 03:26
Shell function for converting videos into GIFs.
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 21 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 50% out-static*.png GIF:- | gifsicle --colors 256 --delay=5 --loop --optimize=3 --mul
tifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
@juliocesar
juliocesar / velocity-animate.jsx
Last active August 29, 2015 14:25
A component for doing child transitions using Velocity.js
// Velocity Animate
// ================
//
// Inspired by https://gist.github.com/tkafka/0d94c6ec94297bb67091.
//
// Extend so it supports:
//
// 1) A transition object in the same format as the ones in the library below,
// directly to the component. Example:
//
@juliocesar
juliocesar / .eslintrc
Last active September 3, 2015 05:48
Ok Build - a build system that's ok, as far as build systems go
{
"ecmaFeatures": {
"globalReturn": true,
"jsx": true,
"modules": true
},
"env": {
"browser": false,
"es6": true,
@juliocesar
juliocesar / vsjsonp.js
Last active August 8, 2016 03:50
Very simple JSONP
// VSJONP ― Very Simple JSONP
// ==========================
//
// Usage:
// fetchJsonP({
// url: 'http://shit-no-cors.json',
// complete: function(response) {
// console.log(response);
// }
// });
@juliocesar
juliocesar / catalanifyme.js
Last active August 29, 2015 14:08
catalanifyme.js
// Catalanify-me dot jay ass
// =========================
//
// Replaces all copy in your website with that famous sentence from an Adam
// Sandler film, "I'm here for the beer and the britches" (or was it something
// else? I can't remember…) said in Catalanese.
//
// Instalation:
//
// At some point in the page, load this script and run:
@juliocesar
juliocesar / gist:9b728487ae4709f8f265
Created July 2, 2014 00:55
My ST2 configuration
{
"caret_style": "phase",
"color_scheme": "Packages/Theme - Tech49/Tech49.tmTheme",
"ensure_newline_at_eof_on_save": true,
"folder_exclude_patterns":
[
".git",
".sass-cache",
"node_modules",
"public/javascript",
@juliocesar
juliocesar / gist:11162250
Last active August 29, 2015 14:00
Macbook Pro (Retina, mid 2012)

15" Macbook Pro (Retina, mid 2012)

Yo!

I'm selling my Macbook Pro Retina (mid 2012). This machine has served me well in many battles. It has witnessed me unleash the fury of a thousand suns while building many Internets around the world.

The specs:

  • Display: 15" Retina display.
  • Processor: 4 cores 2.3GHz Intel Core i7.