Skip to content

Instantly share code, notes, and snippets.

@cfpperche
cfpperche / wget.sh
Created May 6, 2020 13:55 — forked from crittermike/wget.sh
Download an entire website with wget, along with assets.
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.
@cfpperche
cfpperche / gist:b5ce82ef8ce64f7d2bf93a12c29f2b3f
Created April 26, 2020 16:40 — forked from John-Chan/gist:f67ecb428d431ff9e1f39a1c7031fbed
JPA - Tree structure with automatic order and tested operations for it
@Entity
public class TreeCategory extends IdentifiableEntity {
....
@ManyToOne(optional = true)
@JoinColumn(name = "parent_id", referencedColumnName = "id")
public TreeCategory getParent() {
return parent;
}
@cfpperche
cfpperche / gist:ceef5587770177b5320978490fc5be6d
Created April 23, 2020 14:52 — forked from michail-nikolaev/gist:3840973
JPA - Tree structure with automatic order and tested operations for it
@Entity
public class TreeCategory extends IdentifiableEntity {
....
@ManyToOne(optional = true)
@JoinColumn(name = "parent_id", referencedColumnName = "id")
public TreeCategory getParent() {
return parent;
}
#base liquibase gradle
apply plugin: "org.liquibase.gradle"
dependencies {
implementation 'org.postgresql:postgresql'
implementation 'org.liquibase:liquibase-core'
compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.4.0-b180830.0359'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '2.2.3.RELEASE'
@cfpperche
cfpperche / docker-compose postgresql + pgAdmin
Last active May 22, 2024 09:32
docker-compose postgresql + pgAdmin
version: '3'
services:
db:
image: postgres
restart: always
environment:
# To connect to the PostgreSQL database run the following command
# psql -h localhost -p 15432 -U admin -d mydb
- POSTGRES_USER=admin
@cfpperche
cfpperche / db.changelog-master.xml
Created October 2, 2019 14:02 — forked from wwerner/db.changelog-master.xml
Spring Security DB model w/ ACLs & OAuth2 as Liquibase Changeset. Works at least on H2 & Postgres.
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd"
objectQuotingStrategy="QUOTE_ALL_OBJECTS">
<changeSet id="1" author="wwerner">
<comment>Spring Security Authentication - Users, Authorities and ACLs</comment>
@cfpperche
cfpperche / nav-tree.css
Created February 24, 2017 14:46 — forked from birkir/nav-tree.css
Google-styled nav-tree with collapse and expand feature for todc-bootstrap-3.
.nav-tree .list-group-item {
padding: 0;
position: relative;
}
.nav-tree .list-group-item a {
margin: 0;
padding-left: 3px;
height: 28px;
line-height: 28px;
}
@cfpperche
cfpperche / README.md
Created November 22, 2016 18:33 — forked from 0x3333/README.md
Bootstrap Table Fixed Header with Footer

Table Fixed Header

This is to mimic a Table with fixed header at top and a footer.

Different from other options in the internet, this is not automatic layout. You have to build the HTML following the structure above.

This table has rounded corners and the CSS is customized to remove double borders.

Columns width can be px or %, the table-layout is fixed. The table can scroll horizontally and vertically. Fixed the vertical scroll bar not been take in consideration. Now the table will scroll and the header/footer will be aligned correctly.

@cfpperche
cfpperche / gist:ffb7a1d5054e43457da5135bc23707b3
Created July 21, 2016 16:31 — forked from nobuti/gist:3816985
MySQL tables for continent names, country names and their ISO codes
CREATE TABLE IF NOT EXISTS `continents` (
`code` CHAR(2) NOT NULL COMMENT 'Continent code',
`name` VARCHAR(255),
PRIMARY KEY (`code`)
) ENGINE=InnoDB;
INSERT INTO `continents` VALUES
('AF', 'Africa'),
('AS', 'Asia'),
('EU', 'Europe'),
@cfpperche
cfpperche / autodiscover.py
Created June 20, 2016 16:34 — forked from o3bvv/autodiscover.py
Django module autodiscover
from imp import find_module
from importlib import import_module
import sys
def autodiscover_module(module_name, installed_apps=None):
if installed_apps is None:
from django.conf import settings
installed_apps = settings.INSTALLED_APPS