Skip to content

Instantly share code, notes, and snippets.

View fred's full-sized avatar

Frederico Araujo fred

  • Thailand
View GitHub Profile
@davecoutts
davecoutts / unifi_ubuntu_2004.sh
Last active August 26, 2024 04:23
Install Ubiquiti Unifi Controller on Ubuntu 20.04
# Install Ubiquiti Unifi Controller on Ubuntu 20.04.
# As tested on a fresh install of ubuntu-20.04.1-live-server, August 22nd 2020.
# Thanks to https://gist.github.com/tmuncks for posting the updated install steps.
sudo apt update
sudo apt install --yes apt-transport-https
echo 'deb https://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list
sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ui.com/unifi/unifi-repo.gpg
<?php
// how to run:
// php download_refunds.php
// Works on Mac OS X
// It will generate (and overwrite) a csv file with name refunds.csv
// Update your valid Live Secret Key, this is only a test key:
$skey = 'skey_';
// Output file name
<?php
// how to run:
// php download_disputes.php
// Works on Mac OS X
// It will generate (and overwrite) a csv file with name disputes.csv
// Update your valid Live Secret Key, this is only a test key:
$skey = 'skey_';
// Output file name
@michaelkeevildown
michaelkeevildown / credit-card-regex.md
Last active September 15, 2024 07:01
Credit Card Regex Patterns

Credit Card Regex

  • Amex Card: ^3[47][0-9]{13}$
  • BCGlobal: ^(6541|6556)[0-9]{12}$
  • Carte Blanche Card: ^389[0-9]{11}$
  • Diners Club Card: ^3(?:0[0-5]|[68][0-9])[0-9]{11}$
  • Discover Card: ^65[4-9][0-9]{13}|64[4-9][0-9]{13}|6011[0-9]{12}|(622(?:12[6-9]|1[3-9][0-9]|[2-8][0-9][0-9]|9[01][0-9]|92[0-5])[0-9]{10})$
  • Insta Payment Card: ^63[7-9][0-9]{13}$
  • JCB Card: ^(?:2131|1800|35\d{3})\d{11}$
  • KoreanLocalCard: ^9[0-9]{15}$
@sdorra
sdorra / keys.go
Created April 17, 2016 19:31
Golang RSA Key Generation
/*
* Genarate rsa keys.
*/
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
@Dani3lSun
Dani3lSun / adblock_hosts.sh
Last active April 20, 2023 11:49
Mac OS X adblock shell script using system hosts file (Block ads system wide)
#!/bin/sh
#
# Mac OSX Adblocker Script for IPv4
# Description: Blocks ads using system hosts file /private/etc/hosts, Ad-Domains would be redirected to 0.0.0.0
# Author: Daniel Hochleitner
# Created: 10.09.2015
# Use: sudo ./adblock_hosts.sh
# Get original hosts file from /private/etc/hosts
@rossdakin
rossdakin / attributes_default.rb
Last active August 29, 2015 14:10
Chef cookbook for creating NAT boxes (intended for use with AWS OpsWorks) – does not do any health checks, HA, nor automatic route table (re)configuration.
# my_nat_cookbook/attributes/default.rb
# specify your CIDR in custom JSON somewhere: { "my_nat_cookbook": { "source_cidr": "10.1.0.0/16" } }
default[:deliv_nat][:source_cidr] = '0.0.0.0/0'
default[:deliv_nat][:aws_region] = node[:opsworks][:instance][:region]
default[:deliv_nat][:ec2_instance_id] = node[:opsworks][:instance][:aws_instance_id]
@hyoshida
hyoshida / install-patched-ruby-1.8.7-p375.sh
Last active August 3, 2017 04:05
patch for ruby-build error
# patch for make ruby error
# % rbenv install 1.8.7-p375
# ...
# ossl_pkey_ec.c:815: error: ‘EC_GROUP_new_curve_GF2m’ undeclared (first use in this function)
# ossl_pkey_ec.c:815: error: (Each undeclared identifier is reported only once
# ossl_pkey_ec.c:815: error: for each function it appears in.)
# make[1]: *** [ossl_pkey_ec.o] error 1
# ...
#
# refs: http://forums.cpanel.net/f5/case-84173-error-installing-ruby-377831.html
@vjfrancois
vjfrancois / clockwork.cap
Last active August 6, 2016 15:29 — forked from rogercampos/clockwork.rb
Clockwork and delayed_job tasks file for capistrano 3
namespace :workers do
namespace :clockwork do
desc "Stop clockwork"
task :stop do
on roles(:app) do
within release_path do
with rails_env: fetch(:rails_env) do
execute :bundle, :exec, :clockworkd, "-c lib/clockwork.rb --pid-dir=#{cw_pid_dir} --log-dir=#{cw_log_dir} stop"
end
end
@dinge
dinge / gist:6983008
Created October 14, 2013 22:05
calling applescript from ruby
def osascript(script)
system 'osascript', *script.split(/\n/).map { |line| ['-e', line] }.flatten
end
osascript <<-END
tell application "Finder"
display dialog "Hello"
end tell
END