Skip to content

Instantly share code, notes, and snippets.

View Realetive's full-sized avatar

Realetive Realetive

View GitHub Profile
@Realetive
Realetive / oath-qrcode.sh
Created October 11, 2022 23:38 — forked from martint17r/oath-qrcode.sh
Generate TOTP QRcode for Google Authenticator for 2FA on linux debian wheezy
#!/bin/bash
USERNAME=$1
HOSTNAME=$(hostname --fqdn)
qrencode -t ANSI256 -o - $(echo otpauth://totp/$USERNAME@$HOSTNAME?secret=$(oathtool --totp -v $(grep $USERNAME /etc/users.oath | cut -f 4) | grep Base32 | cut -d " " -f 3))
@Realetive
Realetive / widget.md
Created April 5, 2021 05:10 — forked from AlexxNB/widget.md
Howto make no-depends widget on Svelte and load it on the page

We should have at least three files: 'Widget.svelte', 'rollup.config.js' and 'package.json':

  1. Our widget Widget.svelte:
<script>
	export let name;
</script>

<h1>Hello {name}!</h1>
@Realetive
Realetive / remove-gpg-user.sh
Created February 25, 2019 12:36 — forked from phunehehe/remove-gpg-user.sh
Git-crypt remove user.
#!/usr/bin/env bash
#
# Script to remove GPG key from git-crypt
#
# It will re-initialize git-crypt for the repository and re-add all keys except
# the one requested for removal.
#
# Note: You still need to change all your secrets to fully protect yourself.
# Removing a user will prevent them from reading future changes but they will
# still have a copy of the data up to the point of their removal.
@Realetive
Realetive / post-merge
Created June 21, 2017 14:38 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@Realetive
Realetive / gist:da954c146be8e4da51b4a93c0c8e8be0
Created January 20, 2017 20:09 — forked from realmyst/gist:1262561
Склонение числительных в javascript
function declOfNum(number, titles) {
cases = [2, 0, 1, 1, 1, 2];
return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ];
}
use:
declOfNum(count, ['найдена', 'найдено', 'найдены']);
@Realetive
Realetive / gulpfile.js
Created November 24, 2016 14:49 — forked from belozer/gulpfile.js
Gulpfile with gulp-bem-presets
const gulp = require('gulp');
const Builder = require('gulp-bem-bundle-builder');
const bundler = require('gulp-bem-bundler-fs');
const nodemon = require('gulp-nodemon');
const merge = require('merge2');
const debug = require('gulp-debug');
const babel = require('gulp-babel');
const uglify = require('gulp-uglify');
const gulpif = require('gulp-if');
const concat = require('gulp-concat');
@Realetive
Realetive / README.md
Created October 5, 2016 13:01 — forked from addyosmani/README.md
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

Twin Components

Я также спросил это на GitHub. Предположим, есть компоненты Signin и Signup. Они близнецы:

Signup:

<main>
  <h1 className={styles.h1}>Sign Up</h1>
@Realetive
Realetive / affix.html
Last active August 29, 2015 14:17 — forked from Cezarion/affix.html
<script type="text/javascript">
window.onscroll = scroll;
function scroll () {
var scrollTop = window.pageYOffset;
console.log(scrollTop);
if( scrollTop > 363 ){
document.getElementById('summary').style.top="20px";
document.getElementById('summary').style.position="fixed";
}
else
<?php
/*
Output filter to retrieve names of TVs from a list of TV ids
info@pepebe.de
Idea:
Use it with toogleTVSet plugin (included below) to handel different template options.
Usage: