Skip to content

Instantly share code, notes, and snippets.

@huygwen
huygwen / download-csv-from-browser.js
Created January 18, 2022 06:43 — forked from mingrammer/download-csv-from-browser.js
Download CSV files directly from your browser
function createCSV(data) {
var lineDelimiter = '\n';
var csv = {
'title': '',
'head': '',
'body': ''
};
csv.title = 'csv-title.csv';
csv.head = '...'; // make your own csv head
@huygwen
huygwen / bulk_merge.rb
Created January 17, 2022 06:29 — forked from amichal/bulk_merge.rb
csv export and bulk load any rails scope
# Bulk merge a bunch of records
#
# we expect most of the records to import to represent updates
# so this method tries to be efficent with database queries
# by using a single query to find any existing records matching the key_attributes
# updating those records and finally inserting each remaining record
#
# It DOEST NOT use a transaction or lock. callers responsibilty to
# add that if desired
#
@huygwen
huygwen / elixir_symbols.md
Created December 22, 2021 08:01 — forked from h4cc/elixir_symbols.md
All symbols used in the elixir programming language

Symbols used in Elixir

A list of all not symbols and notations of elixir. Tried to have a base for comparision for other programming languages.

Operators

  • === (strict)
  • !== (strict)
  • == (relaxed)
@huygwen
huygwen / LaravelCookieDecrypter.php
Created June 6, 2021 08:02 — forked from glennkarlsen/LaravelCookieDecrypter.php
Decrypt laravel_session outside of the Laravel app. This is just a proof of concept, cleanup and extend to your needs.
<?php
class LaravelCookieDecrypter {
/**
* The encryption key.
*
* @var string
*/
protected $key = 'YOUR LARAVEL .ENV APP KEY';
@huygwen
huygwen / psql-with-gzip-cheatsheet.sh
Created June 6, 2021 07:00 — forked from brock/psql-with-gzip-cheatsheet.sh
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database
@huygwen
huygwen / postgres-setup.md
Created June 4, 2021 17:29 — forked from jackvial/postgres-setup.md
Laravel Postgres Setup

Postgres Setup

Step 1: Install PostgreSQL

Here are the installation steps on Ubuntu (this installation will also work on any Debian-based distribution):

  1. Open a terminal window.
  2. Issue the command sudo apt-get install postgresql.
  3. Type the sudo password necessary to give you admin rights and hit Enter.
  4. Allow apt to pick up any necessary dependencies.