Skip to content

Instantly share code, notes, and snippets.

View rsp's full-sized avatar

Rafał Pocztarski rsp

View GitHub Profile
@mattconnolly
mattconnolly / gist:6435054
Created September 4, 2013 09:59
vagrant file for SmartOS
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
@zeusdeux
zeusdeux / socketio.md
Last active March 18, 2020 22:51
Vanilla websockets vs socket.io

Vanilla websockets vs socket.io

Note: The points below are a comparison of using vanilla websockets on client and server and using 'em via socket.io and not about why only use socket.io

  • Native websockets provide us with only a send method to send data to the server. Send accepts only string input (not too sure about this). Socket.io lets us emit arbitrary events with arbitrary data (even binary blobs) to the server.
  • To receive messages on a vanilla websocket you can only assign a handler for the message event. The data you receive is mostly likely to be text (again not too sure about this) and you will have to parse it manually before consuming it. Socket.io lets the server and client both emit arbitrary events and handles all the parsing and packing/unpacking.
  • Socket.io gives us both a server and a client. Implementing a vanilla websocket server isn't something that you would want to do per project since it's quite painful. You will have to implement [RFC6455](https://tools.ietf.org/h
@menzenski
menzenski / helloworld.asm
Created February 4, 2015 15:24
Hello World in Assembly language (x86-64 Unix-like operating systems, NASM syntax)
; MacOS X: /usr/local/bin/nasm -f macho64 *.s && ld -macosx_version_min 10.7 *.o
; Solaris/FreeBSD/DragonFly: nasm -f elf64 -D UNIX *.s && ld *.o
; NetBSD: nasm -f elf64 -D UNIX -D NetBSD *.s && ld *.o
; OpenBSD: nasm -f elf64 -D UNIX -D OpenBSD *.s && ld -static *.o
; OpenIndiana: nasm -f elf64 -D UNIX *.s && ld -m elf_x86_64 *.o
; Linux: nasm -f elf64 *.s && ld *.o
%ifdef NetBSD
section .note.netbsd.ident
dd 7,4,1
@patrick-steele-idem
patrick-steele-idem / README.md
Last active May 10, 2021 03:52
Syntax: Marko vs Vue

Syntax: Marko vs Vue

Custom tags and passing data

Marko:

<greeting
  name=fullName
  message-count=30
@lkptrzk
lkptrzk / 404-check.sh
Last active April 29, 2022 22:18
Script to test for 404s
#!/bin/sh
# 404-check.sh - Script to test for 404s
# author: lkptrzk
# Usage:
# Assuming a file named 'input' with one URL per line
# the following command will output which files were 404s:
# cat input | xargs 404-check.sh
@briceburg
briceburg / git.md
Created November 22, 2015 05:42
git - checking fast-forward-ness
git merge-base --is-ancestor master HEAD

from man git merge-base

A common idiom to check "fast-forward-ness" between two commits A and B is (or at least used to be) to compute the merge base between A and B, and check if it is the same as A, in which case, A is an ancestor of B. You will see this idiom used

@robertpainsi
robertpainsi / .gitconfig
Last active December 1, 2022 20:05
.gitconfig
[branch]
autosetupmerge = true
[core]
editor = gedit --wait --new-window
pager = less -x1,5
whitespace = trailing-space,space-before-tab,tabwidth=4
[color]
ui = auto
@akwodkiewicz
akwodkiewicz / some-time-ago.js
Created January 29, 2023 11:43
Distance from given date in "X days/weeks/months ago" format using Intl
/**
* Tells you how long ago was `inputDate` in "x days/weeks/months ago" format using `Intl`
* ({@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl docs}).
* Automatically changes the resolution from days, to weeks, to months, to keeps things readable.
* Returns the exact date if the `inputDate` happened very long time ago.
*
* Dates only, time is ignored.
*
* You can use `forcedLocale` to get the string in a specific locale, otherwise a browser locale
* is used.

EDIT from 2019: Hi folks. I wrote this gist for myself and some friends, and it seems like it's gotten posted somewhere that's generated some (ahem, heated) discussion. The whitespace was correct when it was posted, and since then GitHub changed how it formats <pre> tags. Look at the raw text if you care about this. I'm sure someone could tell me how to fix it, but (thank you @anzdaddy for suggesting a formatting workaround) honestly this is a random throwaway gist from 2015, and someone more knowledgable about this comparison should just write a proper blog post about it. If you comment here I'll hopefully see it and stick a link to it up here. Cheers. @oconnor663

Here's the canonical TOML example from the TOML README, and a YAML version of the same.

title = "TOML Example"
 

Here's the canonical TOML example from the TOML README, and a YAML version of the same. Which looks nicer?

title = "TOML Example"

[owner]