Skip to content

Instantly share code, notes, and snippets.

View felipsmartins's full-sized avatar
🇧🇷
loading, please wait a few seconds...

Martins, F. felipsmartins

🇧🇷
loading, please wait a few seconds...
View GitHub Profile
@felipsmartins
felipsmartins / analog-input.md
Created March 4, 2021 15:54
How to disable microphone volume auto adjustment
<?php
define('DEFAULT_TIMEZONE', 'America/Fortaleza');
define('WORKING_DAY_MONDAY', 1);
define('WORKING_DAY_TUESDAY', 2);
define('WORKING_DAY_WEDNESDAY', 3);
define('WORKING_DAY_THURSDAY', 4);
define('WORKING_DAY_FRIDAY', 5);
define('WORKING_DAY_SATURDAY', 6);
define('WORKING_DAY_SUNDAY', 7);
import pymysql
# docker run --name=mymysql -e MYSQL_ROOT_PASSWORD=password -p 127.0.0.1:3310:3306 mysql
def create_database(connection):
# type: (pymysql.connections.Connection) -> None
with connection.cursor() as cursor:
cursor.execute("CREATE DATABASE IF NOT exists testes")
@felipsmartins
felipsmartins / idea.properties
Created August 13, 2020 05:16
JETBRAINS - stop saving terminal session tabs
# custom PhpStorm properties
~/.config/JetBrains/PhpStorm2020.2/idea.properties
# https://youtrack.jetbrains.com/issue/IDEA-117946#focus=Comments-27-4088395.0-0
terminal.persistent.tabs=false
em configurações da VM -> rede -> Adaptador1:
Conectado a: NAT
Avançado:
Tipo de Placa: Rede Paravirtualizada (virtio-net) # <- isso faz a VPN funcionar
import logging.config
# https://docs.python.org/2.7/library/logging.config.html#configuration-dictionary-schema
logging.config.dictConfig({
'version': 1,
'formatters': {
'default': {
'format': '%(levelname)s %(asctime)s [%(name)s]: %(message)s',
'datefmt': '%d-%m-%YT%H:%M:%S'
const express = require('express')
const http = require('http')
const app = express()
const port = 3000
const url = 'http://127.0.0.1:9801'
app.get('/', (req, expressResponse) => {
http.request(url, function (response) {
response.pipe(expressResponse)
@felipsmartins
felipsmartins / update-mongodb.py
Created May 26, 2020 01:12
mongodb update pymongo
import pymongo
import os
from pprint import pprint
uri = os.environ['MONGODB_URI']
client = pymongo.MongoClient(uri)
database = client.get_database("catalog")
collection = database.get_collection("products")
@felipsmartins
felipsmartins / sql_string_from_zend_select.php
Created April 6, 2020 23:46
get sql string from zend select
# $select is instance of \Zend\Db\Sql\Select
$sqlstring = $select->getSqlString($this->getDbAdapter()->getPlatform());
@felipsmartins
felipsmartins / execute_one_single_test.sh
Last active February 20, 2020 07:37
golang execute one single test
go test -v /path/to/package -run TestMyTarget
# or
go test -v my/package/name -run TestMyTarget