Skip to content

Instantly share code, notes, and snippets.

@jabyrd3
jabyrd3 / rawmemutil
Last active November 11, 2022 00:28
read raw mem given pid and start/end range nodejs
import {open, read} from 'fs';
export default (pid, rawStart, rawEnd) => {
return new Promise((res, rej) => {
// 4d674600000-4d674640000 rw-p 00000000 00:00 0
const start = parseInt(`0x${rawStart}`, 16);
const end = parseInt(`0x${rawEnd}`, 16);
const length = end - start;
const buffer = Buffer.alloc(length);
open(`/proc/${pid}/mem`, 'r', (err, fd) => {
read(fd, buffer, 0, length, start, (err, bytesRead, buffer) => {
@route GET /some/path/:dynamicparam/stuff
ret /usr/bin/path-handler.sh request.dynamicparam
@route GET /some/other/path/:id
ret /usr/bin/some-other-path-handler.sh request.id
const Rabbit = require("rabbit-driver");
class Beemer{
constructor(store, rabbitConfig){
this.store = store;
this.loop();
this.mq = new Rabbit(rabbitConfig);
}
loop(){
// calls itself every 5 seconds to message the return from fetchState
this.message(this.fetchState());
@jabyrd3
jabyrd3 / silent.sh
Created February 2, 2018 23:58
Hides 'custom reply' messages from slackbot in a channel defined with 'indexof'
sed -i "" -e '/startup();/ a\
setTimeout(()=>require(\"electron\").remote.webContents.getAllWebContents().map(e=>e.on(\"did-navigate-in-page\",(e,t,n)=>n&&e.sender.executeJavaScript("if(document.title.indexOf(\\"project-sa-code\\") > -1){const style = document.createElement(\\"style\\"); style.type=\\"text/css\\";style.innerHTML = \\".c-message--custom_response { display: none; }\\"; document.getElementsByTagName(\\"head\\")[0].appendChild(style);}\"))), 6000);' /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/index.js

Keybase proof

I hereby claim:

  • I am jabyrd3 on github.
  • I am jabyrd3 (https://keybase.io/jabyrd3) on keybase.
  • I have a public key ASA8ueNSkNtZTktrPMSSDw11GczimGL_hn4N9CasFCIu5Ao

To claim this, I am signing this object:

@jabyrd3
jabyrd3 / fuckyou.js
Created May 17, 2017 04:08
group-members-list
Array.from(document.querySelectorAll('div[data-name="GroupProfileGridItem"] > div>div>div div:last-child div:first-child'))
.map(account=>console.log(account.innerText))
@jabyrd3
jabyrd3 / spotifySnagger.js
Created May 16, 2017 06:12
get artists from spotify playlist markup in chrome
Array.from(document.querySelectorAll('.tracklist-row'))
.map(song => `${song.innerText.split('\n')[1]}, ${song.innerText.split('\n')[2].split('•')[0]}, ${song.innerText.split('\n')[2].split('•')[1]}`)
.reduce((acc, val) => acc += `${val}\n`, '');
'use strict';
window.onload = function () {
var command =
'5 3 \n 1 1 e\n rfrfrfrf\n 3 2 N \n frrffllffrrfll\n 0 3 w\n LLFFFLFLFL';
// this function parses the input string so that we have useful names/parameters
// to define the playfield and the robots for subsequent steps
var parseInput = function (input) {
// task #1
// replace the 'parsed' var below to be the string 'command' parsed into an object we can pass to genworld();
// genworld expects an input object in the form { 'bounds': [3, 8], 'robos': [{x: 2, y: 1, o: 'W', command: 'rlrlff'}]}
this.dimensions = function () {
return _.chain(points)
.filter(function (item) {
if (item !== 'Z') {
return item;
}
})
.map(function (point) {
var command = point[0];
point = point.substr(1, point.length)
@jabyrd3
jabyrd3 / gist:412d6b75ec236854705c
Last active June 17, 2016 01:34
stupid directive to add directives to an element for automatically building UI components
(function () {
'use strict';
/* globals _ */
angular.module('application')
.directive('dynamicDirectives', ['$compile', function ($compile) {
return {
restrict: 'A',
scope: true,
transclude: false,
link: function (scope, elem, attr) {