Skip to content

Instantly share code, notes, and snippets.

View TDFS-Dom's full-sized avatar
🎯
Focusing

Nguyễn Hữu Toàn TDFS-Dom

🎯
Focusing
View GitHub Profile
File: "TNHCustomViewLayout.h"
//
// TNHCustomViewLayout.h
// vyi576_new
//
// Created by Nguyen Huu Toan on 1/19/17.
// Copyright © 2017 Nguyen Huu Toan. All rights reserved.
//
import UIKit
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet weak var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
NSLayoutConstraint.activate([
tableView.topAnchor.constraint(equalTo: view.topAnchor),
#!/bin/bash
# Remove all container
docker stop $(docker ps -a -q) &&
docker rm $(docker ps -a -q)
# Setup Keycloak
echo "Setup Keycloak"
docker network create keycloak-network
docker run -d --name postgres --net keycloak-network -e POSTGRES_DB=keycloak -e POSTGRES_USER=keycloak -e POSTGRES_PASSWORD=password -p 5432:5432 postgres:latest &&
#!/bin/bash
### Set Language
TEXTDOMAIN=virtualhost
### Set default parameters
action=$1
domain=$2
rootDir=$3
owner=$(who am i | awk '{print $1}')
email='hello@forsharing.info'
@TDFS-Dom
TDFS-Dom / test123.skema
Created August 24, 2020 08:23
adfdsfds
[{"name":"Bears","color":"Blue","position":{"x":177,"y":85},"modelclass":"Bear","increment":false,"timestamp":false,"softdelete":false,"column":[{"colid":"c217","name":"id","type":"increments","length":"0","order":0,"defaultvalue":"","enumvalue":""},{"colid":"c218","name":"name","type":"string","length":"200","order":1,"defaultvalue":"","enumvalue":""},{"colid":"c219","name":"danger_level","type":"string","length":"200","order":2,"defaultvalue":"","enumvalue":""}],"relation":[{"extramethods":"","foreignkeys":"","name":"fish","relatedmodel":"Fish","relationtype":"hasOne","usenamespace":""},{"extramethods":"","foreignkeys":"","name":"trees","relatedmodel":"Trees","relationtype":"hasMany","usenamespace":""},{"extramethods":"","foreignkeys":"bear_id, picnic_id","name":"picnics","relatedmodel":"Picnics","relationtype":"belongsToMany","usenamespace":""}],"seeding":[]},{"name":"Fish","color":"Yellow","position":{"x":1063,"y":14},"modelclass":"Fish","increment":false,"timestamp":false,"softdelete":false,"column":[{"c
@TDFS-Dom
TDFS-Dom / Pre-request script.js
Last active May 8, 2021 02:47
Performance api testing with Postman
url_custom = pm.environment.get("url")+"/v2/home?type=0&start=0&limit=20"
method_custom = "GET"
headers_custom = {
"Accept": "application/json",
"Content-Type": "application/x-www-form-urlencoded",
"language": "vi",
"childId": pm.environment.get("childId"),
"Authorization": "Bearer " + pm.environment.get("token"),
"OneSignalId":
pm.environment.get("OneSignalId")
@TDFS-Dom
TDFS-Dom / remove_apache.sh
Last active June 15, 2021 12:33
remove_apache.sh
#!/bin/bash
# This will remove Apache
sudo service apache2 stop
sudo apt-get purge apache2 apache2-utils apache2.2-bin
sudo apt remove apache2.*
sudo apt-get autoremove
whereis apache2
sudo rm -rf /etc/apache2
@TDFS-Dom
TDFS-Dom / apache_install.sh
Last active June 15, 2021 12:48
apache_install.sh
#!/bin/sh
# This script will install a new BookStack instance on a fresh Ubuntu 18.04 server.
# This script is experimental and does not ensure any security.
# Fetch domain to use from first provided parameter,
# Otherwise request the user to input their domain
DOMAIN=$1
if [ -z $1 ]
then
echo ""
@TDFS-Dom
TDFS-Dom / wp_permistion.sh
Created October 24, 2021 00:51
wp_permistion.sh
#!/bin/bash
WP_OWNER=root # <-- wordpress owner
WP_GROUP=root # <-- wordpress group
WS_GROUP=www-data # <-- webserver group
# reset to safe defaults
find . -exec chown ${WP_OWNER}:${WP_GROUP} {} \;
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
@TDFS-Dom
TDFS-Dom / gdrive.js
Created December 1, 2021 09:39
gdrive.js
let jspdf = document.createElement("script");
jspdf.onload = function () {
let pdfDocumentName = "Document-GDrive.VIP";
let doc;
function generatePDF (){
let imgTags = document.getElementsByTagName("img");
let checkURLString = "blob:https://drive.google.com/";
let validImgTagCounter = 0;
for (i = 0; i < imgTags.length; i++) {
if (imgTags[i].src.substring(0, checkURLString.length) === checkURLString){