Skip to content

Instantly share code, notes, and snippets.

View marcanuy's full-sized avatar
💭
⌨ on 🔥

Marcelo Canina marcanuy

💭
⌨ on 🔥
View GitHub Profile
@marcanuy
marcanuy / gist:fb07bfd03781b885371b09a05a1fb456
Created July 15, 2018 14:38
Trying to resolve a website address with a public DNS
dig www.example.com @8.8.8.8
dig www.example.com @9.9.9.9
SHELL := /bin/bash
YARN := yarn
VENDOR_DIR = assets/vendor/
JEKYLL := jekyll
PROJECT_DEPS := package.json
.PHONY: all clean install update
all : serve

Keybase proof

I hereby claim:

  • I am marcanuy on github.
  • I am marcanuy (https://keybase.io/marcanuy) on keybase.
  • I have a public key whose fingerprint is A669 4437 28F1 2537 F26F C799 C3DF 3D9B B733 DB5A

To claim this, I am signing this object:

@marcanuy
marcanuy / mkvToMp3.sh
Created February 19, 2016 23:26
Batch file conversors from videos to mp3
#!/bin/bash
for i in *.mkv
do
ffmpeg -i "$i" -ab 128k -vn "${i%mkv}mp3"
done
@marcanuy
marcanuy / gunicorn-SITENAME-staging.example.com.service
Created August 7, 2015 22:55
Using Systemd to Make Sure Gunicorn Starts on Boot. As Ubuntu has switched to systemd as its service framework starting in 15.04 for all flavors, this is a migration of the Gunicorn upstart job that appears in "Test Driven Development with Django" (http://chimera.labs.oreilly.com/books/1234000000754/ch08.html#_using_upstart_to_make_sure_gunicorn…
# Gunicorn Site systemd service file
[Unit]
Description=Gunicorn server for SITENAME-staging.example.com
After=network.target
After=syslog.target
Environment=sitedir=/Development/sites/SITENAME-staging.example.com
ExecStart=$(sitedir)/virtualenv/bin/gunicorn --chdir $(sitedir)/source workouts.wsgi:application --bind unix:/tmp/SITENAME-staging.example.com.socket
Restart=on-failure
@marcanuy
marcanuy / gist:06cb00bc36033cd12875
Created July 11, 2015 13:35
The 5,000 Most Frequently Used Domain Name Prefixes and Suffixes
1. my+ 1001. se+ 2001. thedaily+ 3001. empire+ 4001. herb+
2. +online 1002. test+ 2002. giant+ 3002. +cook 4002. +teen
3. the+ 1003. fish+ 2003. survey+ 3003. +deluxe 4003. affordable+
4. +web 1004. hk+ 2004. +conference 3004. +crunch 4004. proto+
5. +media 1005. florida+ 2005. twit+ 3005. michigan+ 4005. +ity
6. web+ 1006. fine+ 2006. pick+ 3006. cars+ 4006. myhome+
7. +world 1007. loan+ 2007. +dvd 3007. +forest 4007. plastic+
8. +net 1008. page+ 2008. cinema+ 3008. yacht+ 4008. +kc
9. go+ 1009. fox+ 2009. desi+ 3009. +wallet 4009. +foot
10. +group 1010. +gift 2010. act+ 3010. +contest 4010. +sup
@marcanuy
marcanuy / apache_error_log_parser.sh
Last active April 1, 2024 15:25
Apache error log list ordered by most common errors
#!/bin/bash
sed 's^\[.*\]^^g' error.log | sed 's^\, referer: [^\n]*^^g' | sort | uniq -c | sort -n
@marcanuy
marcanuy / add swap file
Created August 13, 2014 15:03
Enable swap file in Linux. Also solves Composer error when low memory available: "PHP Fatal error: Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:981"
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1
#To enable it at the boot time, add the following entry into /etc/fstab:
/swapfile swap swap defaults 0 0
@marcanuy
marcanuy / PHP csv file reader by line
Last active April 6, 2024 17:07
Iterate through lines in an external file with PHP
<?php
$file = new SplFileObject("animals.csv");
$file->setFlags(SplFileObject::READ_CSV);
foreach ($file as $row) {
list($animal, $class, $legs) = $row;
printf("A %s is a %s with %d legs\n", $animal, $class, $legs);
}
?>
@marcanuy
marcanuy / gist:7666201
Created November 26, 2013 21:03
Show extra info about a process, which process called it, PATH_TRANSLATED and PATH_INFO variables.
ps -p <pid> e | cat