Skip to content

Instantly share code, notes, and snippets.

Avatar

Juan Carlos Ruiz JuanCrg90

View GitHub Profile
@JuanCrg90
JuanCrg90 / ignore_vcr.rb
Created Jan 31, 2020
Ignore VCR in ruby test
View ignore_vcr.rb
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 Jan 20, 2019
Setup Raspberry Pi NAS
View setup.sh
# 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 Jul 28, 2018
bundle exec rails runner "eval(File.read 'drop_queues.rb')"
View 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
Keybase proof
View keybase.md

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:

View I am watching you
crontab -e */30 * * * * say -v whisper "I am watching you"
@JuanCrg90
JuanCrg90 / main.c
Created Jun 28, 2016
Simple double pointer example in C-Lang
View main.c
#include <stdio.h>
#include <stdlib.h>
int main () {
int **matrix;
int i;
int j;
int n;
int m;
@JuanCrg90
JuanCrg90 / main.c
Created Jun 28, 2016
A Simple C-Lang Pointers Example
View main.c
#include <stdio.h>
#include <stdlib.h>
int main () {
typedef struct complex_tag {
float r;
float i;
} complex;
@JuanCrg90
JuanCrg90 / extensions.conf
Created Mar 13, 2016
Asterisk SIP Accounts Configuration
View extensions.conf
[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 Mar 9, 2016
Download Files with python
View downloadExample.py
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 Dec 26, 2015
Burn an image via terminal
View Burn-iso.sh
#Change /dev/sr0 and My-Image.iso
wodim -eject -tao speed=8 dev=/dev/sr0 -v My-Image.iso