Skip to content

Instantly share code, notes, and snippets.

View sergiogarciadev's full-sized avatar
I turn coffee into code (sometimes in bugs).

Sergio Garcia sergiogarciadev

I turn coffee into code (sometimes in bugs).
View GitHub Profile
@nepsilon
nepsilon / pg-backup.md
Last active November 21, 2017 00:27
Proper way to do backup (and restore!) with PostgreSQL 🐘 — First published in fullweb.io issue #51

Proper way to do backup (and restore!) with PostgreSQL 🐘

Postgres provides us several options to do backup just like we want. I’ve tried several strategies in the past, and here is the one I stick to now, for both its simplicity and efficiency.

Backup your database with:

# This is using Postgres custom format
pg_dump -Fc dbname > filename
@nepsilon
nepsilon / git-grep-code.md
Last active November 22, 2016 06:01
How to grep search committed code in git? — First published on fullweb.io issue #47

How to grep search committed code in git?

Search working tree for text matching regular expression regexp:

git grep regexp 

Search working tree for lines of text matching regexp A or B:

git grep -e A --or -e B 

Why I think Webpack is the right approach to build pipelines

(I've reposted this on my blog, which you may find more pleasant to read: http://devlog.disco.zone/2016/06/01/webpack/)

I was asked on Twitter why I think Webpack is the right approach to build tooling in JavaScript applications. My explanation is, uh, a bit longer than fit in a single tweet.

When I say "right approach," I'm specifically talking about the way Webpack's pipeline functions. There are certainly some deficiencies in various aspects of Webpack: it has a rather unintuitive API, and often requires quite a bit of boilerplate to set up. However, even with these issues, I think the core principles of how Webpack functions are sound.

I should also mention here this argument basically applies to SystemJS as well. I'm skeptical of various aspects of SystemJS, but I've only taken a very surface-level look at it, so I'm gonna withhold judgement until I've had a chance

@nepsilon
nepsilon / a-better-setup-for-git.md
Last active October 19, 2020 19:15
A better setup for Git — First published in fullweb.io issue #46

A better setup for Git

Git default configuration is good but it can be personalized to improve your workflow efficiency. Here are some good lines to put in your ~/.gitconfig:

# The basics, who you commit as:
[user]
  name = John Doe
  email = john@doe.org
@nepsilon
nepsilon / 3-python-module-you-can-use-on-cli.md
Last active February 19, 2017 13:35
3 Python modules you can use directly in the CLI — First published in fullweb.io issue #45

3 Python modules you can use directly on the CLI

1. Start a local webserver to serve the file of your current directory on the LAN:

# Python version 2.x:
python -m SimpleHTTPServer 
# Python version 3.x:
python3 -m http.server
@nepsilon
nepsilon / custom-ssh-banner.md
Last active December 22, 2018 17:50
Display a cool banner when you log in with SSH — First published in fullweb.io issue #39

Display a cool banner when you log in with SSH

SSH gives us a way to displaya custom welcome message when a user log in. You can make this message dynamic thanks to update-motd, but here we’ll talk about the SSH built-in feature.

Here is how to do in 3 steps:

Put your message in /etc/issue.net:

$ vim /etc/issue.net
@macournoyer
macournoyer / Output
Last active January 9, 2023 15:12
A Neural Network framework in 25 LOC
$ python xor.py
Training:
Epoch 0 MSE: 1.765
Epoch 100 MSE: 0.015
Epoch 200 MSE: 0.005
* Target MSE reached *
Evaluating:
1 XOR 0 = 1 ( 0.904) Error: 0.096
0 XOR 1 = 1 ( 0.908) Error: 0.092
1 XOR 1 = 0 (-0.008) Error: 0.008
@pramsey
pramsey / pgsql-parallel-postgis.md
Last active December 6, 2015 21:04
Parallel Sequence Scan and PostGIS
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import re
import sys
import base64
import subprocess
import urllib
import lxml.etree