Skip to content

Instantly share code, notes, and snippets.

View davalapar's full-sized avatar
🦁
rawr

@davalapar davalapar

🦁
rawr
View GitHub Profile
@davalapar
davalapar / ssecheck.cpp
Created March 6, 2019 09:02 — forked from hi2p-perim/ssecheck.cpp
Check SSE/AVX instruction support.
/*
Check SSE/AVX support.
This application can detect the instruction support of
SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, SSE4a, SSE5, and AVX.
*/
#include <iostream>
#ifdef _MSC_VER
#include <intrin.h>
#endif
console.groupWithTrace = (name, fn) => {
console.group(name);
fn();
console.groupCollapsed();
console.trace(name);
console.groupEnd();
console.groupEnd();
};
function add(x, y) {
@davalapar
davalapar / sha256.js
Created March 22, 2019 00:46
sha256.js
const crypto = require('crypto');
const sha256 = s => crypto.createHash('sha256').update(s, 'utf8').digest('hex');
module.exports = { sha256 };
@davalapar
davalapar / webpack.config.js
Created March 22, 2019 18:04
sample webpack.config.js
/* eslint-disable camelcase */
const os = require('os');
const path = require('path');
const webpack = require('webpack');
const webpackNodeExternals = require('webpack-node-externals');
const TerserPlugin = require('terser-webpack-plugin');
const Client = (env, argv) => {
const { mode } = argv;
@davalapar
davalapar / script.js
Created March 29, 2019 23:38 — forked from Lewiscowles1986/script.js
Anonymous Upload images to Imgur V3 JS
var ImgurAPIKey = 'YEAH-IM-NOT-GIVING-THAT';
window.addEventListener('paste', function(e) {
function eventPreventDefault(e) {
e.preventDefault();
}
function getClipboardData(e) {
return window.clipboardData || e.clipboardData;
}

XADD streamname [MAXLEN items] * field value [field value ...]

Adds a set of fields with values to the specified stream. If MAXLEN items are exceeded, items are removed from the beginning of the stream to bring the length down to MAXLEN. The "*" field is to autogenerate an item ID, but can be overriden.

Return value

Simple string reply: epoch time (in milliseconds) followed by a .N (for differentiating multiple events on the same millisecond)

@davalapar
davalapar / index.js
Created April 20, 2019 01:55 — forked from xemasiv/index.js
Notifications
var n = new Notification('Connected', { body: 'Well done mate'} );
setTimeout(() => n.close(), 3000);
Notification.permission;
Notification.requestPermission().then(console.log).catch(console.error);
// https://developer.mozilla.org/en-US/docs/Web/API/notification
@davalapar
davalapar / es7-async-await.js
Created May 28, 2019 08:21
Javascript fetch JSON with ES7 Async Await
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch
// async function
async function fetchAsync () {
// await response of fetch call
let response = await fetch('https://api.github.com');
// only proceed once promise is resolved
let data = await response.json();
// only proceed once second promise is resolved
@davalapar
davalapar / index.js
Last active November 10, 2020 13:09
LetsEncrypt Setup, Renew & NodeJS Usage
const fs = require('fs');
const http = require('http');
const https = require('https');
const express = require('express');
const app = express();
app.get('*', (req, res) => res.send('yehh'));
http.createServer(app).listen(80);
@davalapar
davalapar / windows.md
Created October 25, 2019 02:41
Command Lines

EADDRINUSE 80, 8080

  1. Type "netstat -aon" on Command Prompt
  2. Find the relative PID number to 127.0.0.1:8080 (or 3000)
  3. Run "taskkill /f /pid pidnumber"