Skip to content

Instantly share code, notes, and snippets.

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

Hugo Schmitt hugows

🏠
Working from home
View GitHub Profile
@hugows
hugows / dropover.markdown
Last active September 10, 2023 11:00
Add file to Dropover from command line / terminal

Pop_OS! and Kinto configuration

After installing Kinto, I needed some additional tweaks:

  1. Disable the Super key behavior (source)
gsettings set org.gnome.shell.extensions.pop-cosmic overlay-key-action 'WORKSPACES'
gsettings set org.gnome.mutter overlay-key ''
@hugows
hugows / component.js
Created December 10, 2021 17:00
A trick to detect re-renders in React
// Add a random background to the component
// On a re-render, the component gets a new color
// Source of this snippet: https://kyleshevlin.com/using-react-memo-to-avoid-unnecessary-rerenders
const random255 = () => Math.floor(Math.random() * 255)
const randomRGBA = () => {
const r = random255()
const g = random255()
const b = random255()
@hugows
hugows / Monitor new files on a folder
Last active December 9, 2021 13:04
MacOs: Monitor new files, announce events, add new files to Yoink
This didn't work with fswatch, but chokidar with poll monitor was fine:
`chokidar '*.json' -p --poll-interval 1000 -c 'say "{event}" && open -a Yoink {path}'`
I was using this to debug a HTTP server that generated log files every X minutes, so I didn't have to keep checking the terminal.
Another useful idea is to send results of a script to yourself via [Telegram](https://github.com/fabianonline/telegram.sh):
`chokidar '*.json' -p --poll-interval 1000 -c 'check_file.sh {path} | telegram -'`
@hugows
hugows / kinto.ahk
Last active June 9, 2021 08:00
Config. adicionais do kinto.ahk
;; Teclados de Mac no Windows/Linux usando https://github.com/rbreaves/kinto/
; Fixos pra sempre na minha memoria muscular...
!r::Send #r
!e::Send #e
!d::Send #d
!l::Send #l
; PC-style control movement
#Backspace::Send ^{Backspace}
@hugows
hugows / index.js
Created May 6, 2020 19:21 — forked from magbicaleman/index.js
Dynamic imports are very interesting..
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import registerServiceWorker from './registerServiceWorker';
class Dynamic extends Component {
constructor(props) {
super(props);
this.state = { module: null };
}
@hugows
hugows / proxy.js
Created April 16, 2020 19:12
proxy objects reminds me of lua's metatables
const user = {
firstName: 'John',
lastName: 'Doe',
email: 'john.doe@example.com',
}
const handler = {
get(target, property) {
return target[property] || (property + "-not-found");
@hugows
hugows / Text.js
Last active December 11, 2019 12:55
Easy way to replace use custom font in React Native projet
// First install font like: https://blog.bam.tech/developer-news/add-a-custom-font-to-your-react-native-app
import React from 'react';
import {Text as RNText, StyleSheet} from 'react-native';
export default class Text extends React.Component {
constructor(props) {
super(props);
}
@hugows
hugows / unzip_same_folder.sh
Last active December 2, 2019 12:17
nemo file manager - set it to open zip files with this script by default = quick way to handle zip files
#!/usr/bin/bash
parentdir=$(dirname "$@")
cd $parentdir
if [[ $@ == *.zip ]]; then
outputdir=$(basename "$@" ".zip")
fi
if [[ $@ == *.rar ]]; then
outputdir=$(basename "$@" ".rar")
fi
@hugows
hugows / tptacek.go
Created November 23, 2019 10:50
Alternative to jwt-go
package main
import (
"fmt"
"golang.org/x/crypto/nacl/auth"
)
func main() {
plaintext := "Hello folks!"