Skip to content

Instantly share code, notes, and snippets.

View nabilfreeman's full-sized avatar
🤗
hello wrold

Freeman nabilfreeman

🤗
hello wrold
View GitHub Profile
@nabilfreeman
nabilfreeman / lesalon-eslint-config.js
Created August 18, 2021 10:40
LeSalon's eslint config
const IGNORE = 0;
const WARN = 1;
const ERROR = 2;
module.exports = {
root: true,
"extends": "airbnb",
"parser": "babel-eslint",
"rules": {
"import/no-named-as-default-member": IGNORE,
@nabilfreeman
nabilfreeman / migrate-postgres-database-sql.md
Last active February 11, 2022 18:45
How to migrate a Postgres database

How to migrate Postgres database

You have two options:

  • Dumpfile
  • SQL

Dumpfile is totally headless and can be done by the CLI unattended using pg_dump and pg_restore. However, it is a binary file so you cannot make any adjustments to the contents between dump and restore.

SQL outputs a massive INSERT script that allows you to see what is going on, and make any syntax changes that might be needed if your Postgres versions are different. Since it does not use pg_restore, you need to manually respond to a password prompt via psql if you go this way.

@nabilfreeman
nabilfreeman / quora-auth-wall-ublock-origin
Created February 28, 2022 00:29
Stops blur overlay on Quora. Go to: uBlock origin -> Settings -> My Filters -> (paste this in)
! 2022-02-28 https://www.quora.com
www.quora.com##[class*="blocking_wall"]
www.quora.com##*:style(filter: none !important)
www.quora.com##.qu-overflow--hidden:style(overflow:auto!important)
@nabilfreeman
nabilfreeman / lambda-redirect-to-trailing-slash.js
Last active March 7, 2023 20:31
Redirect to trailing slashes on CloudFront with AWS Lambda. (all this because S3 uses 302 redirects instead of 301)
'use strict';
const path = require('path')
const redirect = new_url => {
return {
status: '301',
statusDescription: 'Moved Permanently',
headers: {
location: [{
@nabilfreeman
nabilfreeman / shadowsocks-relay-haproxy.cfg
Last active April 3, 2023 00:00
HAProxy Shadowsocks relay example. You can run this on a server in China with good peering, and then proxy traffic to your outside server. Speed will be better (and improved obfuscation).
# 1. Install haproxy on Ubuntu.
# 2. Edit file path: /etc/haproxy/haproxy.cfg
# 3. Run with: haproxy -f /etc/haproxy/haproxy.cfg
# 4. haproxy will run in the background, so you can disconnect safely.
# 5. Point your Shadowsocks client at <CHINA IP>:8001 (or 8002, etc.) - you will actually be connected to your interational server!
global
defaults
log global
@nabilfreeman
nabilfreeman / copyToFat32.sh
Last active May 9, 2023 00:38
FAT32 File copier & splitter (works with Multiman)
#!/bin/bash
# Are you using Mac OS X?
# You need to install coreutils for this to work.
# try `brew install coreutils`
# or `sudo port install coreutils`
# set a part size that works with FAT32 drives
PART_SIZE=3999
# nice little intro