Skip to content

Instantly share code, notes, and snippets.

View jt3k's full-sized avatar
🐷
Summer is coming!

Andrey Gurtovoy jt3k

🐷
Summer is coming!
View GitHub Profile
@jt3k
jt3k / keybr-com.js
Last active June 29, 2020 15:59
Voice over of the next word at https://www.keybr.com/
// This snippet adds voice-over to the next word in the event of a spacebar or erroneous press
// To sound after an error, you will need to enable "Settings → Miscellaneous → Forgive errors"
// How to use ?
// 1. Open https://www.keybr.com/
// 2. Press Ctrl+Shift+I (or F12) to open devTools
// 3. Paste this code into the console
// 4. Close the devTools
// 5. Enjoy
@lherich
lherich / ssh-host-color
Last active April 13, 2021 10:49
Automatically set random background color in iTerm depending on ssh host
#!/bin/bash
#!/bin/bash
#
# ssh into a machine and automatically set the background
# color of Mac OS X Terminal depending on the hostname.
#
# Installation:
# 1. Save this script to /usr/local/bin/ssh-host-color
# 2. chmod 755 /usr/local/bin/ssh-host-color
# 3. alias ssh=/usr/local/bin/ssh-host-color
@developit
developit / purecomponent.js
Created April 25, 2017 11:43
PureComponent for preact
import { Component } from 'preact';
export default class PureComponent extends Component {
shouldComponentUpdate(props, state) {
return !(shallowEqual(props, this.props) && shallowEqual(state, this.state));
}
}
function shallowEqual(a, b) {
for (let key in a) if (a[key]!==b[key]) return false;
@thensg
thensg / luhn-checksum.js
Last active November 30, 2021 19:27
Calculate or verify a Luhn (Mod10) checksum
/**
* MIT No Attribution
*
* Copyright 2015 Giovanni Thenstead
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@max-mykhailenko
max-mykhailenko / # Sublime Emmet JSX Reactjs.md
Last active November 25, 2022 23:25
Sublime text 3. Enable Emmet in JSX files with Sublime React plugin

This is no longer needed as Emmet supports JSX - you just need to turn it all on. Did a quick tutorial: http://wesbos.com/emmet-react-jsx-sublime/

Thanks, @wesbos

Problem

  • Using emmet in jsx files
  • Emmet expands text when js autocomplete needed
@p0rsche
p0rsche / gist:bf9f43c4716cff3f1e6ad3e587e829aa
Created January 9, 2018 21:57
getTransformToElement polyfill
SVGElement.prototype.getTransformToElement = SVGElement.prototype.getTransformToElement || function(toElement) {
return toElement.getScreenCTM().inverse().multiply(this.getScreenCTM());
};
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var styleEl = document.getElementById('css-layout-hack');
if (styleEl) {
styleEl.remove();
return;
}
styleEl = document.createElement('style');
styleEl.id = 'css-layout-hack';
@dreampiggy
dreampiggy / mov2webp.sh
Created March 6, 2017 05:31
ffmpeg MOV to Animated WebP
ffmpeg -i input.mov -vcodec libwebp -lossless 1 -q:60 -preset default -loop 0 -an -vsync 0 output.webp
@Dani3lSun
Dani3lSun / adblock_hosts.sh
Last active April 20, 2023 11:49
Mac OS X adblock shell script using system hosts file (Block ads system wide)
#!/bin/sh
#
# Mac OSX Adblocker Script for IPv4
# Description: Blocks ads using system hosts file /private/etc/hosts, Ad-Domains would be redirected to 0.0.0.0
# Author: Daniel Hochleitner
# Created: 10.09.2015
# Use: sudo ./adblock_hosts.sh
# Get original hosts file from /private/etc/hosts

Raspberry Pi Zero WH: My Sad Experience With It and How I Burned It Probably by Overclocking

Article finished on: 28.06.2019.
VERDICT: Wi-Fi barely works and connecting it via ethernet/usb to your router is another mess. I think I damaged wifi while overclocking it. Lesson learned: don't overclock RPI0.

RPi Zero WH is a small 32-bit 1GHz arm-based computer with 512mb RAM, wifi, bluetooth, mini HDMI and 2 Micro USB ports developed in the UK.

RPi Zero In a Socket Looks Like Totem

Keyboard doesn't work, see known issues below.