Skip to content

Instantly share code, notes, and snippets.

View vinnymac's full-sized avatar
🤓

Vincent Taverna vinnymac

🤓
View GitHub Profile
@cassidoo
cassidoo / mergerefs.jsx
Created January 10, 2023 22:57
Merge refs in React so a component can have more than one ref
export function mergeRefs(refs) {
return (value) => {
refs.forEach((ref) => {
if (typeof ref === "function") {
ref(value);
} else if (ref != null) {
ref.current = value;
}
});
};
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active April 16, 2024 08:50
set -e, -u, -o, -x pipefail explanation
@lukasnellen
lukasnellen / 00-ssh-tmux-iterm.md
Last active January 18, 2024 00:06
Summary of my remote tmux and ssh configuration to benefit from the iterm2-tmux integration, with ssh authentication socket refreshing

Configuration to use remote tmux over ssh in iterm

This is a compilation of information I found in different postings on the net.

All manual invocation

Basic remote tmux session

tmux can be invoked in command mode using tmux -CC. The simplest way to get a remote tmux session into a window of iterm is to invoke it on the remote host

@acdlite
acdlite / coordinating-async-react.md
Last active March 20, 2022 12:27
Demo: Coordinating async React with non-React views

Demo: Coordinating async React with non-React views

tl;dr I built a demo illustrating what it might look like to add async rendering to Facebook's commenting interface, while ensuring it appears on the screen simultaneous to the server-rendered story.

A key benefit of async rendering is that large updates don't block the main thread; instead, the work is spread out and performed during idle periods using cooperative scheduling.

But once you make something async, you introduce the possibility that things may appear on the screen at separate times. Especially when you're dealing with multiple UI frameworks, as is often the case at Facebook.

How do we solve this with React?

@rueycheng
rueycheng / GNU-Make.md
Last active April 11, 2024 15:23
GNU Make cheatsheet
@Arinerron
Arinerron / root.sh
Last active March 7, 2024 09:24
"Root" via dirtyc0w privilege escalation exploit (automation script) / Android (32 bit)
#!/bin/bash
# Give the usual warning.
clear;
echo "[INFO] Automated Android root script started.\n\n[WARN] Exploit requires sdk module \"NDK\".\nFor more information, visit the installation guide @ https://goo.gl/E2nmLF\n[INFO] Press Ctrl+C to stop the script if you need to install the NDK module. Waiting 10 seconds...";
sleep 10;
clear;
# Download and extract exploit files.
echo "[INFO] Downloading exploit files from GitHub...";
@oakley808
oakley808 / saga-polling.js
Created October 6, 2016 15:47
A recipe for polling an API in redux-saga
export function* main() {
const { payload } = yield take(SOME_START_SIGNAL);
const watcherInstance = yield fork(updateResource, payload);
// cancel task instance on location change
yield take(LOCATION_CHANGE);
yield cancel(watcherInstance);
}
function* updateResource(id) {
@darylenriquez
darylenriquez / method_chain_to_prepend.rb
Last active July 22, 2017 13:21
changing alias_method_chain to prepend
# A simplified explanation for moving alias_method_chain to prepend
# Sample class
class Note
def show_id
puts self.object_id
end
end
# using alias_method_chain:
import ReactDOM from 'react-dom/server'
import React from 'react'
import Typography from '../../src/'
import GoogleFont from '../../src/components/GoogleFont'
import theme from '../../src/themes/us-web-design-standard'
const typography = new Typography(theme)
// Hot reload typography in development.
@ethack
ethack / TypeClipboard.md
Last active April 16, 2024 09:14
Scripts that simulate typing the clipboard contents. Useful when pasting is not allowed.

It "types" the contents of the clipboard.

Why can't you just paste the contents you ask? Sometimes pasting just doesn't work.

  • One example is in system password fields on OSX.
  • Sometimes you're working in a VM and the clipboard isn't shared.
  • Other times you're working via Remote Desktop and again, the clipboard doesn't work in password boxes such as the system login prompts.
  • Connected via RDP and clipboard sharing is disabled and so is mounting of local drives. If the system doesn't have internet access there's no easy way to get things like payloads or Powershell scripts onto it... until now.

Windows

The Windows version is written in AutoHotKey and easily compiles to an executable. It's a single line script that maps Ctrl-Shift-V to type the clipboard.