Skip to content

Instantly share code, notes, and snippets.

@rolldone
rolldone / file_01_kml_split.py
Last active November 2, 2023 13:10
Split KML with single folder
import os
import argparse
import xml.dom.minidom
def get_size_in_kb(string):
return len(string.encode('utf-8')) / 1024
def prettify_xml(elem):
rough_string = xml.dom.minidom.parseString(elem).toprettyxml(indent=" ")
return '\n'.join([line for line in rough_string.split('\n') if line.strip()])
@rolldone
rolldone / bbb.kml
Created August 18, 2023 00:21
bbb.kml
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Peta tanpa judul</name>
<description/>
<Style id="poly-E65100-1200-77-normal">
<LineStyle>
<color>ff0051e6</color>
<width>1.2</width>
</LineStyle>
@rolldone
rolldone / AddFulltextIndexesCommand.php
Created January 12, 2022 23:56 — forked from yobud/AddFulltextIndexesCommand.php
MATCH AGAINST for Doctrine DQL queries
<?php
# xxx/yyyBundle/Command/AddFulltextIndexesCommand.php
/**
* AddFulltextIndexesCommand.php
*
* @author Jérémy Hubert <jeremy.hubert@infogroom.fr>
* @since lun. 26 sept. 2011 09:23:53
*/
namespace xxx\yyyBundle\Command;
@rolldone
rolldone / test_functions.php
Created January 7, 2022 20:38 — forked from is-just-me/test_functions.php
Create combinations,products and update stock with Prestashop WEBSERVICE
<?php
function add_combination($data){
global $webService, $config;
try{
$xml = $webService->get(array('url' => $config["ps_shop"].'api/combinations?schema=blank'));
$combination = $xml->children()->children();
$combination->associations->product_option_values->product_option_values[0]->id = $data["option_id"];
$combination->reference = $data["code"];
$combination->id_product = $data["id_product"];
@rolldone
rolldone / Dockerfile - node
Last active September 25, 2021 12:29
Dockerfile
FROM node:14.16.1
# Create app directory
RUN npm install nodemon -g
RUN npm install sequelize-cli -g
RUN npm install pm2 -g
RUN npm install gm -g
RUN apt-get update
RUN apt-get install -y nginx
@rolldone
rolldone / updateNpm.bat
Created August 27, 2021 22:24 — forked from nokidding/updateNpm.bat
Windows batch file which updates npm for nvm-windows
rem see https://github.com/coreybutler/nvm-windows/issues/300
@echo off
SETLOCAL EnableDelayedExpansion
if [%1] == [] (
echo Pass in the version you would like to install, or "latest" to install the latest npm version.
) else (
set wanted_version=%1
@rolldone
rolldone / SSH _port_forwading_technique.md
Last active September 16, 2022 05:32
SSH Jump old version technique

This is best for publish local project to internet use own public server. For example i have localhost port 80 on my local and planning publish it.

First create your port forwading first and connect to own public server.

ssh -L [new_port_forward]:[new_host_forward]:[ip_host_remote_port] root@localhost -p 2200
or you can use -T without tty terminal
ssh -T -L [new_port_forward]:[new_host_forward]:[ip_host_remote_port] root@localhost -p 2200

Next open new terminal again on your local

@rolldone
rolldone / default.conf
Created May 3, 2021 07:43
Wordpress docker nginx fpm with "nginx proxy manager"
# nginx config
server {
listen 80;
server_name localhost yourdomain.com;
root /var/www/html;
index index.php;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
@rolldone
rolldone / ImageController.js
Created April 16, 2021 12:22 — forked from nesimtunc/ImageController.js
Minio Server - NodeJS - File Upload & Photo Showing Example
const formidable = require('formidable');
const fs = require('fs');
var Minio = require('minio');
let minioClient = new Minio.Client({
endPoint: config.MINIO.ENDPOINT,
port: config.MINIO.PORT,
accessKey: config.MINIO.ACCESS_KEY,
@rolldone
rolldone / localhost.conf
Last active April 11, 2021 22:11
self ssl
[req]
default_bits = 2048
default_keyfile = localhost.key
distinguished_name = req_distinguished_name
req_extensions = req_ext