Skip to content

Instantly share code, notes, and snippets.

@focus-at
focus-at / 01_nginx.conf
Created March 23, 2016 16:05 — forked from jmervine/01_nginx.conf
Nginx Based A/B testing.
worker_processes 1;
events {
worker_connections 1024;
}
http {
include /home/t/nginx/conf/mime.types;
default_type application/octet-stream;
@focus-at
focus-at / upwned247.php
Created December 4, 2016 17:09 — forked from Wack0/upwned247.php
UCam247/Phylink/Titathink/YCam/Anbash/Trivision/Netvision/others IoT webcams : remote code exec: reverse shell PoC. (works only in qemu usermode)
<?php
/*
Updated version, 2016-12-02: fixed shellcode so it *actually* works on QEMU
usermode emulation (seems I pushed an old version), and removed debug output.
-------------------------
NB: THIS PoC ONLY WORKS IN QEMU USERMODE EMULATION!
If anyone wants to fix this, go ahead (no pun intended).
However, I don't have a vulnerable product and am unwilling to acquire one.
@focus-at
focus-at / console_save.js
Last active July 23, 2017 17:13
Save data from console
console.save = function(data, filename){
if(!data) return console.error('console.save: no data');
filename = filename || 'console.json';
if(typeof data === "object"){
data = JSON.stringify(data, undefined, 4)
}
var blob = new Blob([data], {type: 'text/json'});
@focus-at
focus-at / crypto-pbkdf2-example.js
Created December 13, 2016 22:12 — forked from skeggse/crypto-pbkdf2-example.js
Example of using crypto.pbkdf2 to hash and verify passwords asynchronously, while storing the hash and salt in a single combined buffer along with the original hash settings
var crypto = require('crypto');
// larger numbers mean better security, less
var config = {
// size of the generated hash
hashBytes: 32,
// larger salt means hashed passwords are more resistant to rainbow table, but
// you get diminishing returns pretty fast
saltBytes: 16,
// more iterations means an attacker has to take longer to brute force an
@focus-at
focus-at / country_codes.json
Last active August 6, 2017 18:25
Country codes
{
"au": "Австралия",
"at": "Австрия",
"az": "Азербайджан",
"ax": "Аландские о-ва",
"al": "Албания",
"dz": "Алжир",
"as": "Американское Самоа",
"ai": "Ангилья",
"ao": "Ангола",
@focus-at
focus-at / moscow_areas.js
Last active July 23, 2017 18:04
Округа и районы москвы
{
"ЦАО": {
title: "Центральный",
items: [
"Арбат",
"Басманный",
"Замоскворечье",
"Красносельский",
"Мещанский",
"Пресненский",
@focus-at
focus-at / hex_parse.js
Created July 23, 2017 18:19
Parses hexadecimal value to get RGB color values.
var hex = 'ffaadd';
var rgb = parseInt(hex, 16); // value is 1675421
var red = (rgb >> 16) & 0xFF; // returns 255
var green = (rgb >> 8) & 0xFF; // 170
var blue = rgb & 0xFF; // 221
@focus-at
focus-at / example.js
Created June 5, 2018 22:51 — forked from nicolashery/example.js
Combine a pipe of multiple Node.js streams into one stream
var util = require('util')
, Transform = require('stream').Transform
, StreamCombiner = require('./streamcombiner');
var chunks1 = [];
var stream1 = new Transform();
var soFar = '';
stream1._transform = function(chunk, encoding, done) {
chunks1.push(chunk.toString());
var pieces = (soFar + chunk).split('\n');
## How to install mcrypt in php7.2
##
## https://lukasmestan.com/install-mcrypt-extension-in-php7-2/
##
#
# Check version php and pecl
#
php -v # if default php is not 7.2 then use /usr/bin/php7.2 instead php
@focus-at
focus-at / swipe.js
Created June 14, 2019 17:11 — forked from SleepWalker/swipe.js
A simple swipe detection on vanilla js
var touchstartX = 0;
var touchstartY = 0;
var touchendX = 0;
var touchendY = 0;
var gesuredZone = document.getElementById('gesuredZone');
gesuredZone.addEventListener('touchstart', function(event) {
touchstartX = event.screenX;
touchstartY = event.screenY;