Skip to content

Instantly share code, notes, and snippets.

View JuanCrg90's full-sized avatar

Juan Carlos Ruiz JuanCrg90

View GitHub Profile
@JuanCrg90
JuanCrg90 / ignore_vcr.rb
Created January 31, 2020 18:37
Ignore VCR in ruby test
def test_request
WebMock.allow_net_connect!
VCR.turned_off do
response = Hashie::Mash.new(MyApi::Api.new('param').endpoint_call.json)
assert_equal 0, response.number
assert_equal 1234, response.total
end
end
@JuanCrg90
JuanCrg90 / setup.sh
Created January 20, 2019 21:56
Setup Raspberry Pi NAS
# https://howtoraspberrypi.com/create-a-nas-with-your-raspberry-pi-and-samba/
sudo apt update
sudo apt upgrade
sudo mkdir -p /home/shares/public
sudo chown -R root:users /home/shares/public
sudo chmod -R ug=rwx,o=rx /home/shares/public
sudo apt install -y samba samba-common-bin
@JuanCrg90
JuanCrg90 / drop_queues.rb
Created July 28, 2018 16:22
bundle exec rails runner "eval(File.read 'drop_queues.rb')"
# bundle exec rails runner "eval(File.read 'drop_queues.rb')"
queues = Delayed::Job.all.map(&:queue).uniq
Delayed::Job.where(queue: queues).destroy_all
@JuanCrg90
JuanCrg90 / keybase.md
Last active May 24, 2018 20:31
Keybase proof

Keybase proof

I hereby claim:

  • I am juancrg90 on github.
  • I am juancrg90 (https://keybase.io/juancrg90) on keybase.
  • I have a public key ASAMM16703KTt6cw9bxOAlfjacpbG3JqVSO8py670CreWAo

To claim this, I am signing this object:

crontab -e */30 * * * * say -v whisper "I am watching you"
@JuanCrg90
JuanCrg90 / main.c
Created June 28, 2016 01:24
Simple double pointer example in C-Lang
#include <stdio.h>
#include <stdlib.h>
int main () {
int **matrix;
int i;
int j;
int n;
int m;
@JuanCrg90
JuanCrg90 / main.c
Created June 28, 2016 01:02
A Simple C-Lang Pointers Example
#include <stdio.h>
#include <stdlib.h>
int main () {
typedef struct complex_tag {
float r;
float i;
} complex;
@JuanCrg90
JuanCrg90 / extensions.conf
Created March 13, 2016 03:44
Asterisk SIP Accounts Configuration
[local-sip]
include => local-sip
exten => _3XXX,1,Dial(SIP/${EXTEN},10,tTr)
exten => _3XXX,2,Hangup()
exten => *98,1,VoiceMailMain
exten => *98,2,Hangup
@JuanCrg90
JuanCrg90 / downloadExample.py
Created March 9, 2016 02:12
Download Files with python
import urllib2
url = "https://realpython.com/learn/python-first-steps/images/pythonlogo.jpg"
file_name = url.split('/')[-1]
u = urllib2.urlopen(url)
f = open(file_name, 'wb')
meta = u.info()
file_size = int(meta.getheaders("Content-Length")[0])
@JuanCrg90
JuanCrg90 / Burn-iso.sh
Created December 26, 2015 05:24
Burn an image via terminal
#Change /dev/sr0 and My-Image.iso
wodim -eject -tao speed=8 dev=/dev/sr0 -v My-Image.iso