Skip to content

Instantly share code, notes, and snippets.

@neochar
neochar / minio-download.sh
Last active December 6, 2021 08:06 — forked from JustinTimperio/download_from_minio.sh
Download a File to Minio with Curl and Zero External Libraries or Programs
#!/usr/bin/env sh
host=127.0.0.1:9000
s3_key=testuser
s3_secret=testpassword
bucket=$1
path="/${bucket}/$2"
out_file=$3
date=`date -R`
@neochar
neochar / minio-upload.sh
Last active December 6, 2021 08:03 — forked from PhilipSchmid/minio-upload.sh
Upload data to Minio using CURL
#!/bin/bash
# Usage: ./minio-upload testbucket testfile.txt
bucket=$1
file=$2
host=127.0.0.1:9000
s3_key=testuser
s3_secret=testpassword
$rawData = '-----------------------------33101021874828258291396904054\x0D\x0AContent-Disposition: form-data; name=\x22_csrf-con\x22\x0D\x0A\x0D\x0AFncEZnF1nO1ZYJvX7PQs-Oq0EWplnGfJ06n5OElzFhJjPzwlEBzMjg5VyaWNmk-6nYBTLDSqEaCdwZNwEV4nQQ==\x0D\x0A-----------------------------33101021874828258291396904054\x0D\x0AContent-Disposition: form-data; name=\x22RegistrationMailForm[username]\x22\x0D\x0A\x0D\x0A\x0D\x0A-----------------------------33101021874828258291396904054\x0D\x0AContent-Disposition: form-data; name=\x22RegistrationMailForm[email]\x22\x0D\x0A\x0D\[email protected]\x0D\x0A-----------------------------33101021874828258291396904054--\x0D\x0A';
$rawData = preg_replace_callback(
"(\\\\x([0-9a-f]{2}))i",
static function($a) {return chr(hexdec($a[1]));},
$rawData
);
preg_match('/^(?<boundary>.+)$/m', $rawData, $matches);
$parts = explode($matches['boundary'], $rawData);
<?php
require $_SERVER['DOCUMENT_ROOT'] . '/app/config/database.php';
use App\User;
User::checkLogin();
if ($post) {
$acts = [
'create' => [
image:
name: docker/compose:1.22.0
entrypoint: ["/bin/sh", "-c"]
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
CONTAINER_IMAGE: registry.gitlab.com/healthfreaks/healthfreaks
COMPOSE_FILE: ${CI_PROJECT_DIR}/docker-compose.yml:${CI_PROJECT_DIR}/docker-compose.ci.yml
@neochar
neochar / query.sql
Last active November 19, 2018 14:27
Query
Query executed successfully:
update `monitorProducts` as m
set `prodAssignedManager` =
(
select `managr` from
(
select count(*) as counted,
m2.`prodAssignedManager` as `managr`
from monitorProducts m2
@neochar
neochar / index.php
Created June 23, 2018 06:35 — forked from vielhuber/index.php
PHPExcel: Import XLSX and convert to array #php
<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/phpexcel/PHPExcel/IOFactory.php');
$phpexcel_filename = $_SERVER['DOCUMENT_ROOT'].'/import.xlsx';
$phpexcel_filetype = PHPExcel_IOFactory::identify($phpexcel_filename);
$phpexcel_objReader = PHPExcel_IOFactory::createReader($phpexcel_filetype);
$phpexcel_objPHPExcel = $phpexcel_objReader->load($phpexcel_filename);
// convert one sheet
$phpexcel_sheet = $phpexcel_objPHPExcel->getSheet(0);
$phpexcel_highestRow = $phpexcel_sheet->getHighestRow();
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
@neochar
neochar / lock_to_escape.zsh
Created May 31, 2018 13:35
Remap 'Caps Lock' to 'Escape' in zsh/bash
# xmodmap is required
xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'
find $PWD -name "_" -exec awk 'NR%2{f=$1;next;}{c=$0;}{print c > "{}"f;}' {} \;