Skip to content

Instantly share code, notes, and snippets.

View gnomex's full-sized avatar

Kenner Kliemann gnomex

View GitHub Profile
@turicas
turicas / brazilian-cities.csv
Created May 26, 2017 01:02
rows CSV lazy import and export
state city inhabitants area
AC Acrelândia 12538 1807.92
AC Assis Brasil 6072 4974.18
AC Brasiléia 21398 3916.5
AC Bujari 8471 3034.87
AC Capixaba 8798 1702.58
AC Cruzeiro do Sul 78507 8779.39
AC Epitaciolândia 15100 1654.77
AC Feijó 32412 27974.89
AC Jordão 6577 5357.28
@tzmartin
tzmartin / m3u8-to-mp4.md
Last active July 22, 2024 19:15
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@mankind
mankind / rails-jsonb-queries
Last active May 23, 2024 06:47
Ruby on Rails-5 postgresql-9.6 jsonb queries
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails
#payload: [{"kind"=>"person"}]
Segment.where("payload @> ?", [{kind: "person"}].to_json)
#data: {"interest"=>["music", "movies", "programming"]}
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json)
Segment.where("data #>> '{interest, 1}' = 'movies' ")
Segment.where("jsonb_array_length(data->'interest') > 1")
listen 443 ssl;
ssl_certificate /etc/nginx/cert/fullchain.pem;
ssl_certificate_key /etc/nginx/cert/privkey.pem;
ssl_session_cache shared:SSL:20m; #cache size
ssl_session_timeout 180m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #disabling ssl due to security issues
ssl_prefer_server_ciphers on;
ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;
ssl_dhparam /etc/nginx/cert/dhparam.pem;
ssl_stapling on;
@chrisxaustin
chrisxaustin / jgrep
Created April 28, 2016 22:06
grep within all .java files within this directory and all child directories
#!/bin/sh
# Usage: jgrep foo
# Searches all java files under the current directory
grep -i "$*" `find . -name '*.java'`
@vinicius-stutz
vinicius-stutz / README.md
Last active July 23, 2024 16:51
Máscara p/ telefones com 8 ou 9 dígitos (jquery.mask.js)
@vkostyukov
vkostyukov / statuses.md
Last active June 13, 2024 16:30
HTTP status codes used by world-famous APIs
API Status Codes
[Twitter][tw] 200, 304, 400, 401, 403, 404, 406, 410, 420, 422, 429, 500, 502, 503, 504
[Stripe][stripe] 200, 400, 401, 402, 404, 429, 500, 502, 503, 504
[Github][gh] 200, 400, 422, 301, 302, 304, 307, 401, 403
[Pagerduty][pd] 200, 201, 204, 400, 401, 403, 404, 408, 500
[NewRelic Plugins][nr] 200, 400, 403, 404, 405, 413, 500, 502, 503, 503
[Etsy][etsy] 200, 201, 400, 403, 404, 500, 503
[Dropbox][db] 200, 400, 401, 403, 404, 405, 429, 503, 507
@matagus
matagus / .gitconfig
Last active February 15, 2016 11:58
My .gitconfig with a lot of aliases 👽
[user]
name = matagus
email = me@matagus.com
[color]
ui = auto
[color "status"]
added = cyan
changed = green
@bernardobrezende
bernardobrezende / beep.js
Created October 7, 2015 14:04
beep sample
function beep() {
var snd = new Audio("data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaAAihwMWm4G8QQRDiMcCBcH3Cc+CDv/7xA4Tvh9Rz/y8QADBwMWgQAZG/ILNAARQ4GLTcDeIIIhxGOBAuD7hOfBB3/94gcJ3w+o5/5eIAIAAAVwWgQAVQ2ORaIQwEMAJiDg95G4nQL7mQVWI6GwRcfsZAcsKkJvxgxEjzFUgfHoSQ9Qq7KNwqHwuB13MA4a1q/DmBrHgPcmjiGoh//EwC5nGPEmS4RcfkVKOhJf+WOgoxJclFz3kgn//dBA+ya1GhurNn8zb//9NNutNuhz31f////9vt///z+IdAEAAAK4LQIAKobHItEIYCGAExBwe8jcToF9zIKrEdDYIuP2MgOWFSE34wYiR5iqQPj0JIeoVdlG4VD4XA67mAcNa1fhzA1jwHuTRxDUQ//iYBczjHiTJcIuPyKlHQkv/LHQUYkuSi57yQT//uggfZNajQ3Vmz+Zt//+mm3Wm3Q576v////+32///5/EOgAAADVghQAAAAA//uQZAUAB1WI0PZugAAAAAoQwAAAEk3nRd2qAAAAACiDgAAAAAAABCqEEQRLCgwpBGMlJkIz8jKhGvj4k6jzRnqasNKIeoh5gI7BJaC1A1AoNBjJgbyApVS4IDlZgDU5WUAxEKDNmmALHzZp0Fkz1FMTmGFl1FMEyodIavcCAUHDWrKAIA4aa2oCgILEBupZgHvAhEBcZ6joQBxS76AgccrFlczBvKLC0QI2cBoCFvfTDAo7eoOQInqDPBtvrDEZBNYN5xwNwxQRfw8ZQ5wQVLvO8OYU+mHvFLlDh05Mdg7BT6YrRPpCBznMB2r//xKJjyyOh+cImr2/4doscwD6neZjuZR4AgAABYAAAABy1xcdQtxYBYYZdifkUDgzzXaXn98Z0oi9ILU5mBjFANm
@amitpatelx
amitpatelx / README.md
Last active January 9, 2020 20:59
map vs pluck - Getting value of specific column using ActiveRecord

map will load the entire array, then iterate to collect the screen_names.

pluck asks the database for exactly what it needs and returns an array of just those items.

So in case of pluck, performance is gained and less memory is used for large datasets (like production).

Never use map on active record relations, use pluck instead.

If you're using pluck to pass values to a where use select instead