Skip to content

Instantly share code, notes, and snippets.

View sagar290's full-sized avatar
🏠
Working from home

Sagar sagar290

🏠
Working from home
View GitHub Profile
@sagar290
sagar290 / alter-user.sql
Created April 15, 2021 22:00 — forked from backslash112/alter-user.sql
Blog: Start a Remote MySQL Server with Docker quickly
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '<password>';
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '<password>';
@sagar290
sagar290 / mamp-sql-dump-export.sh
Created February 25, 2021 18:25 — forked from oliveratgithub/mamp-sql-dump-export.sh
MAMP MySQL dump export using Terminal.app in macOS
$ cd /Applications/MAMP/Library/bin/
$ ./mysqldump --host=localhost -uroot -proot source_database > ~/Desktop/database_name-dump.sql
package main
import (
"io"
"log"
"net/http"
)
func d(res http.ResponseWriter, req *http.Request) {
io.WriteString(res, "dog dog dog")
server {
server_name server.com;
root /var/www/html/backend/public;
index index.html index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
import boto3
s3 = boto3.client('s3')
for obj in s3.list_objects_v2(Bucket="lms10", Prefix="adm/")['Contents']:
print(obj['Key'])
import pandas as pd
import requests
import json
import sched, time
import base64
from bs4 import BeautifulSoup as BSHTML
# print(df.to_json(orient = 'index', indent = 2))
# print(df.to_json(orient='records', indent = 2))
@sagar290
sagar290 / .gitlab-ci.yml
Last active January 4, 2021 21:39
gitlab ci/cd for postman collection to html documentation
pages:
stage: deploy
script:
- curl -o "docgen" https://raw.githubusercontent.com/thedevsaddam/docgen-bin/master/latest/linux_amd64
- chmod +x ./docgen
- ./docgen build -i collection.json -o ./index.html
- mkdir .public
- cp -r index.html .public
- mv .public public
- rm docgen
<?php
$text = 'sadasda{test}aasdasa asda {test2}';
preg_match_all("/{[^.}]*}/", $text, $var);
//$var = str_ireplace(['{', '}'], '', $var[0][0]);
var_dump($var);
<?php
add_filter( 'rest_authentication_errors', function( $result ) {
if ( ! empty( $result ) ) {
return $result;
}
if ( ! is_user_logged_in() ) {
return new WP_Error( 'rest_not_logged_in', 'You are not currently logged in.', array( 'status' => 401 ) );
}
if ( ! current_user_can( 'administrator' ) ) {
@sagar290
sagar290 / docker-compose.yml
Last active April 21, 2020 08:50
mysql master slave
version: '2'
services:
mysql_db_master:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_ROOT_HOST: 0.0.0.0
ports: