Skip to content

Instantly share code, notes, and snippets.

View abranhe's full-sized avatar
🐂
Coding Furiously

Abraham abranhe

🐂
Coding Furiously
View GitHub Profile
@abranhe
abranhe / .htaccess
Created September 30, 2020 20:57 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@abranhe
abranhe / example1.sql
Created July 18, 2020 03:48
Example SQL Relationship
CREATE TABLE books (
id serial,
title varchar(100) NOT NULL,
author varchar(100) NOT NULL,
published_date timestamp NOT NULL,
isbn char(12),
PRIMARY KEY (id),
UNIQUE (isbn)
);
@abranhe
abranhe / Props
Created June 23, 2020 18:35 — forked from mynameispj/Props
Estimated reading time in PHP, by Brian Cray
Total props to Brian Cray: http://briancray.com/posts/estimated-reading-time-web-design/
@abranhe
abranhe / postgres-cheatsheet.md
Created June 13, 2020 05:52 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@abranhe
abranhe / readme.md
Last active June 13, 2020 05:45
Running pgAdmin with Postgres on Docker - Play with docker

Go to Play with docker and login. Once logged in:

Download pgAdmin

docker pull dpage/pgadmin4

Start the pgAdmin server

@abranhe
abranhe / tutorial.fs
Created June 6, 2020 16:41
Learning F#
// F# is Microsofts functional language
// It provides a way to develop predictable
// code that is often way shorter
// Functional languages apply functions
// to data rather then focus on state changes
// like most OO languages
// Functional languages are great when you
// must execute multiple processes at once.
// Because all variables are immutable it
@abranhe
abranhe / Makefile
Last active June 1, 2020 01:13
Example of Makfile for assignment 1
# You can add comments like this
all: gpa
gpa: lab1.o
gcc lab1.o -o gpa
lab1.o: lab1.c
gcc -c lab1.c -o lab1.o
clean:
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@abranhe
abranhe / readme.md
Last active May 18, 2020 17:31
Get domain name regardless of the subdomain

Get domain name

document.domain

or

window.location.hostname.match(/\w*\.\w*$/gi)[0]
@abranhe
abranhe / readme.md
Last active May 14, 2020 06:01
Java Executables

Convert Java Executable to Linux Executable

Introduction

Java program is universal and applicable to most operating systems, but if someone intends to create a native executable binary file for certain operation system, is that possible?

The answer is yes. Here is the instruction to create an executable program for Linux with .run as its extension name.

Create a text file use your favorite text editor (In this case it is gedit) and type these code below: