Skip to content

Instantly share code, notes, and snippets.

View acro5piano's full-sized avatar
🏠
Working from home

Kay Gosho acro5piano

🏠
Working from home
View GitHub Profile
@acro5piano
acro5piano / README.md
Created February 10, 2022 03:46
simple scraping in terminal

Now, you can scrape website with simple pipe.

$ curl -Ss 'https://moncargo.io' | scrape.rb meta

<meta name="viewport" content="width=device-width">
<meta charset="utf-8">
<meta name="twitter:title" content="MonCargo - Track your cargo online">
@acro5piano
acro5piano / wl-paste-serve.mjs
Created January 29, 2022 08:14
Share wayland clipboard via Node.js standalone server (no deps)
#!/usr/bin/env node
import { createServer } from 'http'
import { exec } from 'child_process'
import { networkInterfaces } from 'os'
const log = (t) =>
console.log(`[${new Date().toLocaleTimeString()}] ` + JSON.stringify(t))
createServer((req, res) => {
@acro5piano
acro5piano / README.md
Created October 18, 2021 14:27
Restore brightness using Arch Linux + System76 Lemur 10 + light

I've created a systemd unit to restore brightness of my laptop (system76 Lemur Pro 10).

It has been worked for almost a year, but suddenly it stopped working. I've fixed by value (sleep 5).

I took the log and found this line, I would like to stop this, but don't know how to do it.

Oct 18 23:17:35 archlinux kernel: video LNXVIDEO:00: Restoring backlight state
@acro5piano
acro5piano / how-to-use.tsx
Last active June 26, 2021 07:34
Background blur-ed Twilio video track
export const MyComponent() {
const { toggleVideoBlur, isVideoBlur } = useBlurLocalTrack({})
const _toggleVideoBlur = async () => {
twilioRoom.localParticipant.videoTracks.forEach((track) => track.unpublish())
const videoTrack = await toggleVideoBlur()
await wait(1000)
participant.publishTrack(videoTrack)
}
import { useState } from 'react'
export const Draggable: React.FC<{}> = ({ children }) => {
const [position, setPosition] = useState({ x: 0, y: 0 })
return (
<div
className="cursor-move"
draggable
style={{ transform: `translate(${position.x}px, ${position.y}px)` }}
diff --git a/src/components/Room/Room.tsx b/src/components/Room/Room.tsx
index 443c1f120..7cb7c3f5e 100644
--- a/src/components/Room/Room.tsx
+++ b/src/components/Room/Room.tsx
@@ -1,7 +1,15 @@
-import React from 'react';
+import React, { useRef, useEffect } from 'react';
import ParticipantList from '../ParticipantList/ParticipantList';
import { styled } from '@material-ui/core/styles';
import MainParticipant from '../MainParticipant/MainParticipant';
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/[email protected]"></script>
<style>
.relative {
position: relative;
}
.renderer {
width: 400px;
@acro5piano
acro5piano / test.tsx
Created April 28, 2021 11:20
react re-render test for children prop
import { memo, useState, useMemo } from 'react'
const MODE = 'memo'
function MiddleRaw({ children }) {
console.log('middle')
return <div>{children}</div>
}
const Middle = memo(MiddleRaw)
@acro5piano
acro5piano / urqlClient.ts
Last active December 4, 2023 13:56
URQL + Firebase authentication
import {
Exchange,
cacheExchange,
createClient,
dedupExchange,
fetchExchange,
subscriptionExchange,
} from 'urql'
import { delay, empty, fromPromise, map, mergeMap, pipe, tap } from 'wonka'
import firebase from 'firebase' // NOTE: This is old Firebase version
@acro5piano
acro5piano / MyComponent.tsx
Last active April 10, 2021 07:29
A react hook to handle keyboard show/hide
const { inputting } = useInputting()
<div style={{ height: inputting ? '50vh' : '100vh' }}>
...