Skip to content

Instantly share code, notes, and snippets.

View paveltimofeev's full-sized avatar

Pavel Timofeev paveltimofeev

View GitHub Profile
@paveltimofeev
paveltimofeev / cors-nginx.conf
Created September 20, 2017 11:32 — forked from alexjs/cors-nginx.conf
Slightly tighter CORS config for nginx
#
# Slightly tighter CORS config for nginx
#
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs
#
# Despite the W3C guidance suggesting that a list of origins can be passed as part of
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox)
# don't seem to play nicely with this.
#

JS Patterns Collection

@paveltimofeev
paveltimofeev / WebSec checking services.md
Last active October 9, 2017 08:52
WebSec checking services.md

Check websites' security

URL=sbrbnk.org

http://threatcrowd.org/domain.php?domain=%URL% (graph)
http://www.urlvoid.com/scan/%URL%
https://otx.alienvault.com/indicator/hostname/%URL%/
https://www.virustotal.com/en/domain/%URL%/information/
@paveltimofeev
paveltimofeev / keys.go
Created August 8, 2017 14:34 — forked from sdorra/keys.go
Golang RSA Key Generation
/*
* Genarate rsa keys.
*/
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
@paveltimofeev
paveltimofeev / deepSum.js
Last active July 21, 2017 08:31
deepSum.js
// passthru all nested 'n' props of 'o', and sum their values
function deepSum(o,n) {
var c=0;
if(_.isObject(o)){_.each(_.keys(o||{}), k => { c+= k===n ? parseInt(o[n])||0 : deepSum(o[k],n);});}
return c;
}
var item = {
doc_count: 2,
val: {
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@paveltimofeev
paveltimofeev / gen-map.html
Last active January 20, 2017 09:27
Generate 8x maps by md5 hash
<html>
<head>
<title>Gen-map</title>
</head>
<body>
<div style="float: left">
<h1 id="title">Formation: </h1>
<canvas id="myCanvas" width="300" height="100"></canvas>
<br>
@paveltimofeev
paveltimofeev / Docker_hints_tips_tricks.md
Last active April 5, 2017 12:21
Docker hints, tips & tricks

Docker hints, tips & tricks

How to remove all exited containers:

docker rm $(docker ps -aq -f exited=137)    # exited by 137 code
docker rm $(docker ps -aq -f exited=0)      # exited by 0 code

How to remove all unused images:

@paveltimofeev
paveltimofeev / aws-hints.md
Last active April 5, 2017 12:21
AWS Hints & Tricks

AWS Hints, Tips & Tricks

How to get Route53 HostedZone Id for apex domain name

sudo apt install -y jq  # sudo yum install -y jq
apex=google-moogle.com

hostedZoneIdRaw=`aws route53 list-hosted-zones-by-name --dns-name $apex. --max-item 1 | jq '.HostedZones[0].Id'`
hostedZoneId=`expr substr $hostedZoneIdRaw 14 14`

Angular Quickly (another approach)

app3.js:

function configApp() {
  
  // todo configuration
}