Skip to content

Instantly share code, notes, and snippets.

View alpenzoo's full-sized avatar

Narcis Iulian Paun alpenzoo

View GitHub Profile
@alpenzoo
alpenzoo / autocomplete-off.html
Created June 4, 2020 14:11
Major browsers and password managers ignore autocomplete=off and do not adhere to the standards. This is an workaround. At the moment it works
<form class="form-horizontal frm--ver-cnp" id="frmConfirmEmail">
<input autocomplete="false" name="hidden" type="text" style="display:none;">
<div id="frmErrorMsg" class="alert alert-danger text-left collapse" role="alert" style="display: none;"><span></span></div>
<div class="form-group row">
<div class="col-sm-12">
<input type="text" class="passInput" name="inputpin[]" maxlength="1" size="1" autocomplete="new-password" min="0" max="9" required="" pattern="\d{1}" autofocus="">
<input type="text" class="passInput" name="inputpin[]" maxlength="1" size="1" autocomplete="new-password" min="0" max="9" required="" pattern="\d{1}">
<input type="text" class="passInput" name="inputpin[]" maxlength="1" size="1" autocomplete="new-password" min="0" max="9" required="" pattern="\d{1}">
<input type="text" class="passInput" name="inputpin[]" maxlength="1" size="1" autocomplete="new-password" min="0" max="9" required="" pattern="\d{1}">
<input type="text" class="
@alpenzoo
alpenzoo / index.html
Created March 13, 2020 14:48 — forked from agarzon/index.html
My Html5 template with Jquery and Bootstrap from CDN
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Project Title</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
@alpenzoo
alpenzoo / char_lo_up.php
Last active March 6, 2020 08:20
php upper lower for standard en chars
<?php
setlocale(LC_CTYPE, 'de_DE.UTF8');
function myUpper($char){
$lo = ord($char);
$up = $lo & 0x5f;
return $up;
}
function myLower($char){
$up = ord($char);
$lo = $up ^ 0x20;
@alpenzoo
alpenzoo / chrome_no-cors_no-ca.bat
Created February 14, 2020 12:57
.bat file to open chrome browser with disabled security, handy for web development in unfriendly environment. not for browsing the web.
start .\chrome.exe --disable-web-security --ignore-certificate-errors --user-data-dir="D:/Chrome"
exit
<?php
$opt = array(
"--zoom"=>'1',
"--disable-smart-shrinking"=>'',
"--page-size"=>'A4',
"--orientation"=>'Landscape',
"--margin-bottom"=>'0',
"--margin-top"=>'0',
"--margin-left"=>'0',
"--margin-right"=>'0'
@alpenzoo
alpenzoo / sample-php-headers.php
Created December 11, 2019 09:13 — forked from ScottPhillips/sample-php-headers.php
PHP Header Examples
301 moved permanently (redirect):
<?php
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.example.com');
die();
?>
302 moved temporarily(redirect):
<?php
header('Location: http://www.example.com');
(function(x, f=()=>x){
var x;
var y=x;
x=2;
return [x,y,f()];
})(1)
@alpenzoo
alpenzoo / gist:2d83444fcd1f17b522f0aea92b3d67c0
Created August 20, 2019 14:54
sample encapsulated variables, setters and getters
function myfunc(){
var data = {
name:'',
age:0,
roles:[],
prefs:{
timezone:1,
theme:'light',
lng:'en'
}
<?php
/** Encryption setup CODE **/
$key = openssl_pkey_new(array('private_key_bits' => 2048));
$private_key = openssl_pkey_get_details($key);
$public_key = $private_key['key'];
echo "<pre>";
print_r($private_key);
echo "</pre>";
@alpenzoo
alpenzoo / README.md
Created May 27, 2019 15:22 — forked from valyala/README.md
Optimizing postgresql table for more than 100K inserts per second

Optimizing postgresql table for more than 100K inserts per second

  • Create UNLOGGED table. This reduces the amount of data written to persistent storage by up to 2x.
  • Set WITH (autovacuum_enabled=false) on the table. This saves CPU time and IO bandwidth on useless vacuuming of the table (since we never DELETE or UPDATE the table).
  • Insert rows with COPY FROM STDIN. This is the fastest possible approach to insert rows into table.
  • Minimize the number of indexes in the table, since they slow down inserts. Usually an index on time timestamp with time zone is enough.
  • Add synchronous_commit = off to postgresql.conf.
  • Use table inheritance for fast removal of old data: