My Elasticsearch cheatsheet with example usage via rest api (still a work-in-progress)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Read CSV file and convert to parquet, upload to S3 | |
def csv_manipulation(self, merchant: str, directory: str): | |
temp = [] | |
schema = pyarrow.schema(self.get_schema()) | |
p = Pool(processes=self.limit_process) | |
for f in os.listdir(directory): | |
filepath = os.path.join(directory, f) | |
try: | |
with open(filepath, 'r', encoding='ISO-8859-1') as csvfile: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<modal @modal-close="handleClose"> | |
<form | |
@submit.prevent="handleConfirm" | |
slot-scope="props" | |
class="bg-white rounded-lg shadow-lg overflow-hidden" | |
style="width: 460px" | |
> | |
<slot :uppercaseMode="uppercaseMode" :mode="mode"> | |
<div class="p-8"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected function saveImgBase64($param, $folder) | |
{ | |
list($extension, $content) = explode(';', $param); | |
$tmpExtension = explode('/', $extension); | |
preg_match('/.([0-9]+) /', microtime(), $m); | |
$fileName = sprintf('img%s%s.%s', date('YmdHis'), $m[1], $tmpExtension[1]); | |
$content = explode(',', $content)[1]; | |
$storage = Storage::disk('public'); | |
$checkDirectory = $storage->exists($folder); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use GuzzleHttp\Client; | |
class GetWeChatOpenId | |
{ | |
protected function getWechatOpenId($token) | |
{ | |
try { | |
$wechatOauthUrl = env('WECHAT_URL'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$head = fopen("file.txt", "r"); | |
if ($head) { | |
while (($line = fgets($head)) !== false) { | |
// process the line read. | |
} | |
fclose($head); | |
} else { | |
// error opening the file. | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getUrlParameter = function getUrlParameter(sParam) { | |
var sPageURL = decodeURIComponent(window.location.search.substring(1)), | |
sURLVariables = sPageURL.split('&'), | |
sParameterName, | |
i; | |
for (i = 0; i < sURLVariables.length; i++) { | |
sParameterName = sURLVariables[i].split('='); | |
if (sParameterName[0] === sParam) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Manual setting | |
### 1. step | |
#### create file {root}/.htaccess: | |
``` | |
<IfModule mod_rewrite.c> | |
Options +FollowSymlinks | |
RewriteEngine On | |
</IfModule> | |
<IfModule mod_rewrite.c> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache |
NewerOlder