Skip to content

Instantly share code, notes, and snippets.

View jazlopez's full-sized avatar
🏠

Jaziel Lopez jazlopez

🏠
  • Thermo Fisher Scientific
  • Tijuana, MX
View GitHub Profile
@scribu
scribu / test.php
Created February 8, 2013 03:12
Simulate threads in PHP using only proc_open() and co.
<?php
include __DIR__ . '/threads.php';
$commands = array();
for ( $i=0; $i<10; $i++ ) {
$commands[] = "bash -c 'sleep `shuf -i 1-5 -n 1`; echo $i'";
}
@JeffreyWay
JeffreyWay / .vimrc
Last active January 22, 2024 11:42
My .vimrc file
set nocompatible " Disable vi-compatibility
set t_Co=256
colorscheme xoria256
set guifont=menlo\ for\ powerline:h16
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
set linespace=15
@protrolium
protrolium / ffmpeg.md
Last active July 12, 2024 17:37
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@mikermcneil
mikermcneil / example-of-custom-policies-hook.js
Created June 26, 2015 17:43
example of using a hook to apply policies to specific shadow routes that were injected by another hook (specifically the swagger hook, in this case)
// For info on setting up this hook, check out the docs here: http://sailsjs.org/#!/documentation/concepts/extending-sails/Hooks/usinghooks.html
module.exports = function (sails) {
return {
routes: {
before: {
// If you want to protect the home route as it is exposed by the swagger hook (i.e. rather than protecting a particular action)
// you can do so by setting a shadow route here. Note however that this hook must run BEFORE the swagger hook does.
@manuelmeurer
manuelmeurer / swap.yml
Created June 30, 2015 09:29
Ansible role for creating a Swap file
- name: set swap_file variable
set_fact:
swap_file: /mnt/{{ swap_space }}.swap
- name: check if swap file exists
stat:
path: "{{ swap_file }}"
register: swap_file_check
- name: create swap file
@jazlopez
jazlopez / mysql-whereis-logs.sh
Last active June 12, 2016 07:30
OSX | Mysql | List location of log files
#!/usr/bin/env bash
mysql -se "SHOW VARIABLES" -u :user -p | grep -e log_error -e general_log -e slow_query_log
# Response:
#
# general_log OFF
# general_log_file /usr/local/var/mysql55/:user.log
# log_error /usr/local/var/mysql55/:user.err
@jazlopez
jazlopez / remove-pattern-files.sh
Last active August 3, 2016 08:48
Remove files by pattern file name/extension
$find . -type f -name "FILE-TO-FIND" -exec rm -f {} \;
# -iname "FILE-TO-FIND" : File pattern, case insensitive, e.g. -iname “*.png”, match all png files
# -exec rm -rf {} \; : Delete all files matched by file pattern.
# -type f : Only match files and do not include directory names.
@miglen
miglen / linux-networking-tools.md
Last active July 16, 2024 23:38
Linux networking tools

List of Linux networking tools

netstat (ss)

Displays contents of /proc/net files. It works with the Linux Network Subsystem, it will tell you what the status of ports are ie. open, closed, waiting, masquerade connections. It will also display various other things. It has many different options. Netstat (Network Statistic) command display connection info, routing table information etc. To displays routing table information use option as -r.

Sample output:

Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)    
tcp4 0 0 127.0.0.1.62132 127.0.0.1.http ESTABLISHED
@jazlopez
jazlopez / reflect.py
Created June 29, 2018 19:29 — forked from 1kastner/reflect.py
A simple echo server to inspect http web requests
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from http.server import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
@jazlopez
jazlopez / upload.files.s3.localstack.sh
Created February 20, 2019 22:17
Upload files in directory to S3 bucket (localstack)
#!/usr/bin/bash
# Jaziel Lopez,
# Software Engineer
# function __localstack_put_object() {
#
# fn="localstack-s3-put-object"
#
# echo "Localstack, storing bucket objects... please wait...";