Skip to content

Instantly share code, notes, and snippets.

View fogrew's full-sized avatar
🚀
Open for new opportunities

Andrew Gurylev fogrew

🚀
Open for new opportunities
View GitHub Profile
@Alexs7zzh
Alexs7zzh / .eleventy.js
Created April 24, 2021 04:44
eleventy-img in markdown
const Image = require('@11ty/eleventy-img')
const { parseHTML } = require('linkedom')
module.exports = eleventyConfig => {
if (process.env.ELEVENTY_ENV)
eleventyConfig.addTransform('transform', (content, outputPath) => {
if (outputPath && outputPath.endsWith('.html')) {
let { document } = parseHTML(content)
@jamesog
jamesog / README.md
Last active September 14, 2023 11:47
Yubikey SSH without GPG

Yubikey as an SSH key

All other guides I've seen (https://github.com/drduh/YubiKey-Guide being the most prolific) tell you to use the Yubikey's smartcard (PKCS#11) features with GnuPG via gpg-agent.

STOP THE MADNESS!

OpenSSH has supported OpenSC since version 5.4. This means that all you need to do is install the OpenSC library and tell SSH to use that library as your identity.

Prequisites

@publicarray
publicarray / Nginx.md
Last active September 29, 2020 21:12
Nginx with modules and latest OpenSSL [CentOS]

Nginx/OpenSSL on CentOS

System

  1. Set up iCloud Keychain
  2. Remove icons and hide Dock
  3. Default address in iMessage
  4. Install Updates
  5. Add Ru Input Sources
  6. Set up Shortcuts
  7. Add text shortcuts Text
@rmwxiong
rmwxiong / gist:ad6e922dcc739a599640
Last active May 21, 2020 14:57 — forked from paulirish/gist:357048
Fix for color components with single digit values
// get the average color of two hex colors.
function avgcolor(color1,color2){
var avg = function(a,b){ return (a+b)/2; },
t16 = function(c){ return parseInt((''+c).replace('#',''),16) },
hex = function(c){ var t = (c>>0).toString(16);
return t.length == 2 ? t : '0' + t },
hex1 = t16(color1),
hex2 = t16(color2),
r = function(hex){ return hex >> 16 & 0xFF},
g = function(hex){ return hex >> 8 & 0xFF},
// Underline
@mixin underline($color, $width) {
background:
linear-gradient(
to top,
$color,
$color #{$width}em,
transparent #{$width}em,
transparent
) repeat-x;
@astronom
astronom / browser_detection.js
Created April 7, 2014 17:16
additional browser detection
// from http://ryanmorr.com/the-state-of-browser-detection/
if('opera' in window && ({}).toString.call(window.opera) === '[object Opera]'){
// detect Opera 14-
}
if('operamini' in window && ({}).toString.call(window.operamini) === '[object OperaMini]'){
// detect Opera Mini
}
if('PalmSystem' in window){
// detect webOS
}
@ndarville
ndarville / webm.md
Last active September 30, 2023 18:56
4chan’s guide to converting GIF to WebM - https://boards.4chan.org/g/res/41212767

Grab ffmpeg from https://www.ffmpeg.org/download.html

It's a command line tool which means you will have to type things with your keyboard instead of clicking on buttons.

The most trivial operation would be converting gifs:

ffmpeg -i your_gif.gif -c:v libvpx -crf 12 -b:v 500K output.webm
  • -crf values can go from 4 to 63. Lower values mean better quality.
  • -b:v is the maximum allowed bitrate. Higher means better quality.
@ilovejs
ilovejs / BrowserDetect.js
Created February 5, 2014 00:06
detect browser
/*
BrowserDetect.browser == 'Explorer';
BrowserDetect.version <= 8;
*/
var BrowserDetect =
{
init: function () {
this.browser = this.searchString(this.dataBrowser) || "Other";
this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "Unknown";
},