Skip to content

Instantly share code, notes, and snippets.

View fijimunkii's full-sized avatar
🦁
𐂃͠

Harrison Powers fijimunkii

🦁
𐂃͠
View GitHub Profile
@fijimunkii
fijimunkii / github_cleanup_disabled_workflows.sh
Created February 14, 2023 19:20
delete github actions runs for disabled workflows
#!/bin/sh
# delete github actions runs for disabled workflows
repo="$1"
for workflow_id in $(gh api /repos/$repo/actions/workflows | jq -r '.workflows[] | select(.state == "disabled_manually") | .id'); do
for run_id in $(gh api /repos/$repo/actions/workflows/$workflow_id/runs | jq -r '.workflow_runs[].id'); do
gh api /repos/$repo/actions/runs/$run_id -X DELETE
sleep 1 # to avoid rate limit
done
done
@fijimunkii
fijimunkii / gpd_pocket_3.md
Last active April 14, 2022 21:31
GPD Pocket 3 setup
@fijimunkii
fijimunkii / cast_to_string.c
Created August 16, 2020 20:08
cast to string c++
#include <string> // std::string
#include <string.h> // string
#include <sstream> // std::stringstream
std::ostringstream stream;
stream << remoteCharacteristic->readUInt16();
std::string strValue = stream.str();
@fijimunkii
fijimunkii / get_extract_hash_post.js
Created August 16, 2019 15:55
node fetch get extract hash post
// 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 July 26, 2019 20:01 — forked from rizky/gui-docker.md
Running Graphical applications in Docker for Mac

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 June 5, 2019 20:45
node get multiple https urls and join result
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 June 5, 2019 14:25
Update a gist with node core
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 November 5, 2024 21:22
Top 10 Most Common User Agents
[
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KH
@fijimunkii
fijimunkii / server-middleman.js
Last active March 15, 2019 21:33
node http net socket middleman
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();
});