Skip to content

Instantly share code, notes, and snippets.

View luanlmd's full-sized avatar

Luan Almeida luanlmd

View GitHub Profile
import { useEffect, useState } from 'react';
export const useFetch = (url: string) => {
const [data, setData] = useState('');
const [loading, setLoading] = useState(false);
useEffect(() => {
if (url !== '') {
setData('');
setLoading(true);
@luanlmd
luanlmd / docker-compose.yml
Last active May 9, 2022 02:26
Mongo + ParseServer + Dashboard on Docker
version: '3'
services:
mongo:
image: mongo
ports:
- 27017:27017
volumes:
- ./data-db:/data/db
@luanlmd
luanlmd / playlist.js
Last active December 5, 2017 14:34
export google music playlist to text
// open the playlist page on google music
// open js console
// paste the code bellow
// go to http://playlist-converter.net
// use convert from plain text with the result of the script
// profit
// repeat
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
@luanlmd
luanlmd / backtrace.php
Last active November 1, 2017 20:25
just a test
<?php
function log_exec()
{
$stack = json_encode(debug_backtrace(), JSON_PRETTY_PRINT) . "\n\n";
file_put_contents('/tmp/log.txt', $stack, FILE_APPEND);
}
function middle_func()
{
@luanlmd
luanlmd / vuejs-todo.html
Created July 28, 2017 19:50
VueJS simplest todo ever
<html>
<head>
<title>VueJS simplest todo ever</title>
<script src="https://unpkg.com/vue"></script>
</head>
<body>
<div id="app">
<ul>
@luanlmd
luanlmd / Vagrantfile
Created July 6, 2016 19:22
Vagrantfile LAMP
$script = <<SCRIPT
apt-get update
apt-get install sudo
gpasswd -a vagrant sudo
echo "mysql-server mysql-server/root_password password password" | debconf-set-selections
echo "mysql-server mysql-server/root_password_again password password" | debconf-set-selections
apt-get -y install mysql-server
sed -i "s/.*bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/my.cnf
@luanlmd
luanlmd / teamspeak.service
Created April 27, 2016 23:13
Ubuntu 16.04 Systemd TeamSpeak service file
[Unit]
Description=Teamspeak Service
After=network.target
[Service]
WorkingDirectory=/opt/teamspeak3-server_linux_amd64
ExecStart=/opt/teamspeak3-server_linux_amd64/ts3server_minimal_runscript.sh
ExecStop=/opt/teamspeak3-server_linux_amd64/ts3server_startscript.sh stop
ExecReload=/opt/teamspeak3-server_linux_amd64/ts3server_startscript.sh restart
PIDFile=/opt/teamspeak3-server_linux_amd64/ts3server.pid
@luanlmd
luanlmd / git_remove_files.sh
Last active December 16, 2015 20:11
git remove old commit files
# change the 'filename.ext' part and run
git filter-branch -f --index-filter "git rm -r --cached --ignore-unmatch filename.ext" --tag-name-filter cat -- --all
@luanlmd
luanlmd / benchdrive.sh
Last active November 9, 2016 17:55
Test your drive speed
#!/bin/bash
printf "\nBlowing up your hard drive... please wait.\n"
printf "\nWriting:\n"
dd if=/dev/zero of=testfile bs=1024k count=512
printf "\nReading:\n"
dd if=testfile of=/dev/null
@luanlmd
luanlmd / sublime-refresh-browser.sh
Created February 6, 2015 01:32
Refresh browser from sublime text
#!/bin/sh
# keybind: { "keys": ["ctrl+d"], "command": "exec", "args": { "cmd": ["/home/luan/scripts/sublime-refresh-browser.sh"]} }
xdotool search --onlyvisible --class "chromium" windowfocus key ctrl+r
xdotool search --onlyvisible --class "sublime-text" windowfocus