Skip to content

Instantly share code, notes, and snippets.

View AaronNGray's full-sized avatar

Aaron Gray AaronNGray

View GitHub Profile
import React, { useState, useEffect } from "react";
import axios from "axios";
const App = () => {
const [username, setUsername] = useState("");
const [password, setPassword] = useState("");
const [user, setUser] = useState();
useEffect(() => {
const loggedInUser = localStorage.getItem("user");
@fnky
fnky / ANSI.md
Last active April 26, 2024 16:45
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@azinneera
azinneera / uuid-gen.xslt
Last active February 12, 2024 10:17
XSLT generate unique UUID
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:math="http://exslt.org/math" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:uuid="http://www.uuid.org" version="2.0">
<xsl:output method="xml" encoding="UTF-8"/>
<xsl:template match="/">
<Payment xmlns="http://ws.apache.org/ns/synapse">
<xsl:for-each select="//Order/lunch">
<discount>
<li>
<xsl:attribute name="uid" select="uuid:get-uuid(drinkName)"/>
<xsl:value-of select="drinkName"/>
<span>
@veltman
veltman / README.md
Created September 2, 2017 12:31
SVG animation to video

Converting an SVG animation to a video with the MediaRecorder API and a hidden canvas.

Drawing frames from img elements can introduce an extra delay, so this version generates all the frames upfront and then renders them in a loop with requestAnimationFrame().

See also: Canvas animation to video

// Fourier Transform Module used by DFT, FFT, RFFT
function FourierTransform(bufferSize, sampleRate) {
this.bufferSize = bufferSize;
this.sampleRate = sampleRate;
this.bandwidth = 2 / bufferSize * sampleRate / 2;
this.spectrum = new Float64Array(bufferSize/2);
this.real = new Float64Array(bufferSize);
this.imag = new Float64Array(bufferSize);
@veltman
veltman / draw.js
Created July 2, 2016 04:33
D3 frames to video
// Pipe to ffmpeg with something like:
// node draw.js | ffmpeg -y -c:v png -f image2pipe -r 20 -i - -an -c:v libx264 -pix_fmt yuv420p -movflags +faststart myvideo.mp4
var Canvas = require("canvas"),
d3 = require("d3"),
topojson = require("topojson"),
rw = require("rw"),
world = require("./world-110m.json");
var width = 1280,
@wangheda
wangheda / gist:568b11ba97a958604e54
Last active December 10, 2021 23:42
Downloading full CiteSeerX dataset

Lately I need to use CiteSeerX dataset in my research, and I've been following the instructions [on this blog][1].

Sadly, due to the update of OAIHarvester, that is not working anymore. Here is my version that works.

  1. Download [OAIHarvester2][2] from oclc.org, the latest version is 2-0.1.12 when I write this.

  2. Run such command to download full CiteSeerX dataset:

    java -classpath .:harvester2.jar:log4j-1.2.12.jar:xalan.jar:xercesImpl.jar:xml-apis.jar ORG.oclc.oai.harvester2.app.RawWrite -out citeseerx_alldata.xml  http://citeseerx.ist.psu.edu/oai2
    
@runeb
runeb / js-exif-rotate.html
Created May 23, 2014 10:49
Auto-rotate images locally in the browser by parsing exif data
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<input id="file" type="file" accept="image/*" />
<br/>
<h2>As read:</h2>
<img id="placeholder1" width=300/><br/>
<h2>Rotated by exif data:</h2>
<img id="placeholder2" width=300/>
<script>
@casecode
casecode / secure-websockets
Last active April 19, 2023 17:50
Basic Config for SSL with Secure Websockets using Nginx 1.6.0 + Puma + Thin
=========================
# /etc/nginx/nginx.conf
=========================
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
@soarez
soarez / ca.md
Last active April 22, 2024 03:01
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.