Skip to content

Instantly share code, notes, and snippets.

View ppsirius's full-sized avatar
🤙

Piotr Pupczyk ppsirius

🤙
View GitHub Profile
@ppsirius
ppsirius / bash.sh
Created February 24, 2021 12:29
Find dependencies in package-lock.json
find . -name "package*.json" -exec sh -c " grep '\"lodash\"' {} && echo {}" \;
import React, { useEffect } from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import GuardLink from '../../../containers/GuardLink';
import styles from './styles.module.scss';
import Config from '../../../config/';
import { rolesAccess } from '../../../constants';
import { MAIN_MENU } from '../../../containers/App/constants'
import Hamburger from '../Hamburger'
allAssets: { [key: string]: string }
data.map(fileName => {
return {
[fileName]: allAssets[fileName]
};
});
@ppsirius
ppsirius / mask.js
Created July 30, 2019 12:58
Mask letters without first and last 3 characters
const maskString = data => {
const firstThreeChar = /(^.{3})/g
const lastThreeChar = /(.{3}$)/g
const maskedString = data.replace(/./g, String.fromCharCode(32, 183, 32)).slice(6)
return data.match(firstThreeChar) + maskedString + data.match(lastThreeChar)
}
@ppsirius
ppsirius / valiadion.js
Created July 10, 2019 08:06
aws s3 bucket name validation RegEx
{
bucketNameValidationRules: [
// rules from https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-s3-bucket-naming-requirements.html
v => !!v || 'Name is required',
v => (v && /^[\a-z\d\.\-]*$/.test(v)) || 'The bucket name can contain only lower-case characters, numbers, periods, and dashes.',
v => (v && /^[\a-z\d]/.test(v)) || 'The bucket name must start with a lowercase letter or number.',
v => (v && !/\-$/.test(v)) || `The bucket name can't end with a dash`,
v => (v && !/\.+\./.test(v)) || `The bucket name can't have consecutive periods`,
v => (v && !/\-+\.$/.test(v)) || `The bucket name can't end with dash adjacent to period`,
v => (v && !/^(?:(?:^|\.)(?:2(?:5[0-5]|[0-4]\d)|1?\d?\d)){4}$/.test(v)) || `The bucket name can't be formatted as an IP address`,
import React, { useState } from "react"
import Fade from 'react-reveal/Fade';
import Layout from "../components/structure/layout"
import { useStaticQuery, Link } from "gatsby"
import { Heading, Flex, Text, Box, Image } from "rebass"
import styled from "styled-components"
import theme from "../components/structure/theme"
import Img from "gatsby-image"
import MyButton from "../components/myButton"
import VisibilitySensor from "react-visibility-sensor";
@ppsirius
ppsirius / package.json
Created April 24, 2019 09:12
package.json update
npm i -g npm-check-updates
ncu -u
npm install
@ppsirius
ppsirius / docker.md
Created February 21, 2019 22:43
Docker shortcut

list

docker ps

cointainer bash

docker exec -it cc73eb6d6f75 bash

@ppsirius
ppsirius / gist:ff1e08c7ca5eecdf58ef804ba6288fd0
Created August 3, 2018 19:37
Check mainboard model on ubuntu
sudo dmidecode -t 2
@ppsirius
ppsirius / hashcat_macos.sh
Created July 24, 2018 20:13
hashcat_macos
git clone https://github.com/hashcat/hashcat.git
mkdir -p hashcat/deps
git clone https://github.com/KhronosGroup/OpenCL-Headers.git hashcat/deps/OpenCL
cd hashcat/ && make
./hashcat --version
./hashcat -m 2500 file.hccapx slownik.txt