Skip to content

Instantly share code, notes, and snippets.

🦁
𐂃͠

Harrison Powers fijimunkii

🦁
𐂃͠
Block or report user

Report or block fijimunkii

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fijimunkii
fijimunkii / get_extract_hash_post.js
Created Aug 16, 2019
node fetch get extract hash post
View get_extract_hash_post.js
// grab page - extract text - send post request back to same page
const crypto = require('crypto');
const http = require('http');
const querystring = require('querystring');
const host = 'someapp.host';
const port = 38008;
const path = '/';
const options = { host, port, path };
let Cookie;
@fijimunkii
fijimunkii / gui-docker.md
Created Jul 26, 2019 — forked from rizkyario/gui-docker.md
Running Graphical applications in Docker for Mac
View gui-docker.md

Setup

Docker for Mac lets you run any Linux executable in an isolated process on Mac. A graphical app is just another process, that needs access to the X11 socket of the system, or an X11 server. You can run X11 applications on a Mac using an open source project called Xquartz. The steps to expose XQuartz to a Linux process running in Docker are simple:

  1. install XQuartz from xquartz.org. Note: you need to install XQuartz version 2.7.10, version 2.7.11 does not work with Docker for Mac. Then you have 3 choices:
  2. Proxy the XQuartz socket to port 6000 or
  3. Tell Xquartz to accept network calls. This is not very secure.
  4. Tell Xquartz to accept network calls and require authentication, setup X11 security using xauth, and mount ~/.Xauthority in the container.
@fijimunkii
fijimunkii / fetch-join-async.js
Created Jun 5, 2019
node get multiple https urls and join result
View fetch-join-async.js
const https = require('https');
const urls = ['https://postman-echo.com/get','https://httpbin.org/anything'];
Promise.all(urls.map(url => new Promise((resolve,reject) => {
https.get(url, r => {
const data = [];
r.on('data', d => data.push(d));
r.on('end', () => resolve(Buffer.concat(data).toString()));
}).on('error',console.log);
})))
.then(d => console.log(d.join('')), console.log);
@fijimunkii
fijimunkii / gist-patch.js
Created Jun 5, 2019
Update a gist with node core
View gist-patch.js
const data = JSON.stringify({a:1,b:2,c:3},null,2);
const GIST_ID = 'axdl090asdfojal3rwaf';
const GITHUB_TOKEN = process.env.GITHUB_TOKEN;
return new Promise((resolve, reject) => {
const postData = JSON.stringify({files:{"ua.json":{content:data}}});
const options = {
hostname: 'api.github.com',
port: 443,
path: `/gists/${GIST_ID}`,
@fijimunkii
fijimunkii / ua.json
Last active Jun 3, 2019
Top 10 Most Common User Agents
View ua.json
[
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15",
"Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0",
@fijimunkii
fijimunkii / server-middleman.js
Last active Mar 15, 2019
node http net socket middleman
View server-middleman.js
const app = require('http').createServer((req, res) => { res.end((new Date()).toISOString()); })
const listener = require('net').createServer(connection => {
connection.once('data', buffer => {
connection.pause();
console.log(buffer.toString('utf8'));
app.emit('connection', connection);
connection.emit('data', buffer);
connection.resume();
});
@fijimunkii
fijimunkii / crypto-iv.js
Created Jan 22, 2019
encrypt and decrypt with initialization vector
View crypto-iv.js
// encrypt and decrypt with initialization vector
// http://vancelucas.com/blog/stronger-encryption-and-decryption-in-node-js/
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', new Buffer.from(ENCRYPTION_KEY), iv);
let encrypted = cipher.update(text);
@fijimunkii
fijimunkii / https-get-gzbomb-safe.js
Last active Dec 7, 2018
node native https gz promise with gzbomb protection
View https-get-gzbomb-safe.js
const https = require('https');
const zlib = require('zlib');
return new Promise((resolve, reject) => {
const options = {
hostname: 'fullstory.com',
port: 443,
path: '/s/fs.js',
method: 'GET'
};
const req = https.request(options, async (res) => {
@fijimunkii
fijimunkii / dark-mode-slack-mac-osx.sh
Last active Oct 31, 2018
dark mode for slack mac osx app
View dark-mode-slack-mac-osx.sh
echo "
document.addEventListener('DOMContentLoaded', function() {
\$.ajax({
url: 'https://raw.githubusercontent.com/fijimunkii/slack-night-mode/master/css/raw/black.css',
success: function(css) {
\$(\"<style></style>\").appendTo('head').html(css);
}
});
});
" >> /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js
You can’t perform that action at this time.