Skip to content

Instantly share code, notes, and snippets.

@johnrees
johnrees / cheeto.js
Last active December 23, 2023 02:29
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function () {
const speed = 1; // Adjust for faster or slower movement
const container = document.createElement("div");
container.style.position = "fixed";
container.style.top = 0;
container.style.bottom = 0;
container.style.left = 0;
container.style.right = 0;
@johnrees
johnrees / gist:b116e426bc73040876c0
Created February 6, 2016 13:38
streaming desktop to rtmp using ffmpeg
$ git clone https://github.com/iizukanao/node-rtsp-rtmp-server
$ coffee -c .
$ node server.js
$ ffmpeg -f avfoundation -i "0" -vcodec libx264 -tune zerolatency -s 320x480 -vf crop=320:480:0:0 -f flv rtmp://0.0.0.0/live/desktop
# stream on ios device
$ git clone https://github.com/iMoreApps/ffmpeg-avplayer-for-ios-tvos
$ open AVPlayerDemo.xcodeproj (change rtmp stream to rtmp://<LOCAL_IP>/live/desktop, build and run)
// go to following or followers page
let values = new Set([]);
let height = 0;
function scroll() {
if (height < document.body.scrollHeight) {
height = document.body.scrollHeight;
window.scrollTo(0, height);
setTimeout(scroll, 2000);
[
@johnrees
johnrees / gist:1670449
Created January 24, 2012 14:32
Remote IP on Heroku
def remote_ip
if forwarded = request.env["HTTP_X_FORWARDED_FOR"]
forwarded.split(",").first
elsif addr = request.env["REMOTE_ADDR"]
addr
end
end
@johnrees
johnrees / avatars.ts
Last active February 18, 2022 05:49
anchor viz
import axios from "axios";
import { createWriteStream } from "fs";
import { resolve } from "path";
async function downloadImage(url, filename) {
const path = resolve(__dirname, "../avatars", filename);
const response = await axios({
method: "GET",
url,
responseType: "stream",
on:
release:
types:
- published
jobs:
tweet:
runs-on: ubuntu-latest
steps:
- uses: ethomson/send-tweet-action@v1
with:
const {
getHashedName,
getNameAccountKey,
NameRegistryState,
} = require("@solana/spl-name-service");
const {
Connection,
clusterApiUrl,
PublicKey,
@johnrees
johnrees / _ubuntu_steps.sh
Last active November 29, 2021 01:42
Standard Rails 5.* setup for Ubuntu 14.04 LTS
# As root user
sudo su
# Update the OS
sudo apt-get update -y
# Add this to ~/.bashrc to remove timezone warnings
echo 'export LC_ALL="en_US.UTF-8"' >> ~/.bashrc
source ~/.bashrc
name mint_address
Ape #91 FUcUDinc5nvCzkt3CRRzYbbWaXpCJzD6CogUn8zp2jC8
Ape #143 Fk2Pdz9kJFm6AHoKs75y35Sr7nmMY93EMrwjXk4Zybs1
Ape #148 CkExwWKgapXYaYpWEFug4Ezba9EXWBTJ3fgcofhRrLC7
Ape #156 3Nxp3oXqY6YVZkPfQXk9iDjdvUcNZM6Wp6bPWrdHc5Jk
Ape #178 5bzsQ17MsQrAuPZ7i5RqjE9Yw89As4VpeHR1ePuTU7ei
Ape #180 G4VshHmcaVn7Y5aqiF7Zn8iZ2wmprwf3KCwf3sdpBGRL
Ape #195 3PRZ7r6t3THHwNYv2A8jM1KGjA8Jqid49GhwGRBbhnnP
Ape #198 Ao5tVE1pRV3CjJBAsU1uMZND3tgpgr2enoMEeTVAk9pt
Ape #207 5yR2tWxeib8WjQGMTQCqZBiFs9Api5kioo1oixVJRL63
@johnrees
johnrees / example-request.sh
Last active September 12, 2021 19:31
caching test
curl https://rpc.goo.tools -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getProgramAccounts",
"params": [
"cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ",
{
"dataSlice": { "offset": 0, "length": 0 }
}