Skip to content

Instantly share code, notes, and snippets.

View techkuz's full-sized avatar
🎯
Focusing

Kuz Le techkuz

🎯
Focusing
View GitHub Profile
@techkuz
techkuz / broken_pdf.xml
Created August 19, 2017 07:09
broken_pdf
%PDF-1.6
%âãÏÓ
1 0 obj
<</AcroForm 59 0 R/MarkInfo<</Marked true>>/Metadata 2 0 R/Names 60 0 R/Pages 235 0 R/Type/Catalog/Perms 233 0 R/StructTreeRoot 243 0 R/NeedsRendering true>>
endobj
2 0 obj
<</Length 4114/Subtype/XML/Type/Metadata>>stream
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.4-c005 78.150055, 2013/08/07-22:58:47 ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
@techkuz
techkuz / install-postgres-10-ubuntu.md
Last active May 2, 2018 05:28
Install PostgreSQL 10 on Ubuntu

Install PostgreSQL 10 on Ubuntu

This is a quick guide to install PostgreSQL 10 - tested on Ubuntu 16.04

Add PostgreSQL apt repository

The current default Ubuntu apt repositories (up to 02.05.2018) only have up to postgresql-9.5. To get 10, we'll add the official postgres apt repository.

  • Ubuntu 16.04: sudo add-apt-repository 'deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main'
@techkuz
techkuz / display_obj.js
Created June 4, 2018 08:05
Display readable javascript object
alert(JSON.stringify(obj, null, 4)); // beautiful indented output.
@techkuz
techkuz / offset.js
Created June 5, 2018 10:03
left and top positions of element - javascript
function getOffset(el) {
el = el.getBoundingClientRect();
return {
left: el.left + window.scrollX,
top: el.top + window.scrollY
}
}
// https://stackoverflow.com/a/28222246/7127824
// getOffset(element).left
@techkuz
techkuz / install-coffeescript.MD
Created June 13, 2018 12:00
Install and launch coffeescript locally
  1. Install npm
  2. $ npm install --save-dev coffeescript
  3. $ npx cake or $ npx coffee
@techkuz
techkuz / example.py
Last active June 29, 2018 13:46
jinja with mustache(or handlebars) templates
# in your template put all your mustache code inside this raw tags
{% raw %}
<script type="text/template" id="company-template">
<a href="#companies/{{id}}/jobs" class="list-group-item">
<h4 class="list-group-item-heading">{{name}}</h4>
<p class="list-group-item-text">{{description}}</p>
</a>
</script>
{% endraw %}
@techkuz
techkuz / get_param.js
Last active June 29, 2018 08:31
Js - get request parameter from current url
function getParam() {
var currUrl = window.location.href;
var url = new URL(currUrl);
var param = url.searchParams.get('param');
return param;
}
@techkuz
techkuz / code.sh
Created July 19, 2018 07:46
Ignore file after once commited (keep the commited version)
git update-index skip-worktree file
@techkuz
techkuz / pyenv_command.sh
Created September 24, 2018 07:39 — forked from xnoder/pyenv_command.sh
pyenv cheat sheet
# List all available versions
$ pyenv versions
system
# Install Python3 on machine as full binary
$ pyenv install 3.5.2
# Create virtualenv out of 3.5.2
$ pyenv virtualenv 3.5.2 developer
$ pyenv activate developer
SELECT table,
formatReadableSize(sum(bytes)) as size,
min(min_date) as min_date,
max(max_date) as max_date
FROM system.parts
WHERE active
GROUP BY table