Skip to content

Instantly share code, notes, and snippets.

@YurySolovyov
YurySolovyov / class-names.cljs
Created July 2, 2017 12:17
class-names for ClojureScript
(defn class-names [& args]
(clojure.string/join " "
(mapv name
(reduce (fn [arr arg]
(cond
(or (string? arg)
(symbol? arg)
(keyword? arg)) (conj arr arg)
(vector? arg) (vec (concat arr arg))
(map? arg) (vec (concat arr
@foonathan
foonathan / borrow.cpp
Last active August 24, 2023 08:42
Quick'n'dirty implementation of Rust's borrow checker for a C++Now Lightning Talk - not supposed to be used
#include <iostream>
#include "borrow_checker.hpp"
int main()
{
auto i = 42;
// borrow `i` under name `ref`
borrow_var(ref, i)
@SimonLlewellyn
SimonLlewellyn / share.js
Created May 2, 2017 00:21
Share to Facebook, Twitter, G+
function shareTwitter(title,url){
//url = encodeURI(url);
var t = title;
var lnk = "https://twitter.com/intent/tweet?text="+t+"&url="+url+"&via=NZBandGear";
window.open(lnk, 'mywin','left=50,top=50,width=600,height=350,toolbar=0');
return false;
}
//===========================================================================
function shareFacebook(url){
var lnk = "http://www.facebook.com/sharer.php?u="+url;
@juusechec
juusechec / sse.go
Created December 22, 2016 13:25
Un script que envía peticiones a un servidor SSE (Server Send Event) recibe peticiones en base16 y las decodifica.
package main
import (
"fmt"
"io"
"log"
"net/http"
"net/url"
//"time"
"crypto/aes"
@thomasdarimont
thomasdarimont / readme.md
Last active May 8, 2025 10:51
Example for decoding a JWT Payload with your Shell (bash, zsh...)

Setup

Add this to your .profile, .bashrc, .zshrc...

decode_base64_url() {
  local len=$((${#1} % 4))
  local result="$1"
  if [ $len -eq 2 ]; then result="$1"'=='
  elif [ $len -eq 3 ]; then result="$1"'=' 
  fi
 echo "$result" | tr '_-' '/+' | openssl enc -d -base64
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active May 3, 2025 08:56
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@superbrothers
superbrothers / main.go
Created September 8, 2016 02:42
http request with context in Go
package main
import (
"context"
"fmt"
"log"
"net/http"
"time"
)
@neilrenicker
neilrenicker / ffmpeg.md
Created July 12, 2016 13:56
How to convert an m4a file to an mp3 using ffmpeg

Convert an m4a file to an mp3 using ffmpeg

  • Install ffmpeg using homebrew:
brew install ffmpeg
  • convert the file:
@shandanjay
shandanjay / core.clj
Created July 11, 2016 06:31 — forked from nikolaplejic/core.clj
File upload example in Compojure
(ns fileupload.core
(:use [net.cgrand.enlive-html
:only [deftemplate defsnippet content clone-for
nth-of-type first-child do-> set-attr sniptest at emit*]]
[compojure.core]
[ring.adapter.jetty])
(:require (compojure [route :as route])
(ring.util [response :as response])
(ring.middleware [multipart-params :as mp])
(clojure.contrib [duck-streams :as ds]))
@Brainiarc7
Brainiarc7 / VAAPI-hwaccel-encode-Linux-Ffmpeg&Libav-setup.md
Last active May 14, 2025 23:36
This gist contains instructions on setting up FFmpeg and Libav to use VAAPI-based hardware accelerated encoding (on supported platforms) for H.264 (and H.265 on supported hardware) video formats.

Using VAAPI's hardware accelerated video encoding on Linux with Intel's hardware on FFmpeg and libav

Hello, brethren :-)

As it turns out, the current version of FFmpeg (version 3.1 released earlier today) and libav (master branch) supports full H.264 and HEVC encode in VAAPI on supported hardware that works reliably well to be termed "production-ready".