Skip to content

Instantly share code, notes, and snippets.

View jogaco's full-sized avatar
🎯
Focusing

J. Garcia jogaco

🎯
Focusing
View GitHub Profile
@noplanman
noplanman / mullvad_get_vpn_configs.sh
Created November 21, 2016 22:44
Download all VPN config files for Mullvad VPN
#!/usr/bin/env bash
# Set the Mullvad account number.
ACCOUNT_NUMBER="1234"
# For the home network, make sure the external IP is set here
# to prevent local traffic from going through the VPN.
HOME_IP=""
# Load the config download page to get CSRF tokens.
@CoryFoy
CoryFoy / analytics.rb
Last active July 18, 2023 21:01
An example of calling the Analytics API using machine creds and the V4 API from Ruby
require 'google/apis/analyticsreporting_v4'
require 'googleauth'
include Google::Apis::AnalyticsreportingV4
include Google::Auth
VIEW_ID = "12345678" #your profile ID from your Analytics Profile
SCOPE = 'https://www.googleapis.com/auth/analytics.readonly'
@client = AnalyticsReportingService.new
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active November 14, 2024 10:34
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@richhollis
richhollis / add_user_name_to_users.rb
Last active May 9, 2020 07:26
Rails 4.2.5.1 and Devise 3.5.6 using attr_encrypted with email attribute encrypted and username clear text
class AddUserNameForAuthenticationToUsers < ActiveRecord::Migration
def up
add_column :users, :username, :string, null: false, default: ""
add_index :users, :username, unique: true
add_column :users, :encrypted_email, :string
remove_column :users, :email, :string
add_index :users, :encrypted_email
end
def down
remove_column :users, :username
@drmalex07
drmalex07 / README-python-service-on-systemd-activated-socket.md
Last active July 4, 2024 07:29
An example network service with systemd-activated socket in Python. #systemd #python #socket #socket-activation

README

The example below creates a TCP server listening on a stream (i.e. SOCK_STREAM) socket. A similar approach can be followed to create a UDP server on a datagram (i.e. SOCK_DGRAM) socket. See man systemd.socket for details.

An example server

Create an simple echo server at /opt/foo/serve.py.

@cesarandreu
cesarandreu / Gemfile
Created November 15, 2014 00:25
FakeS3 automation for rspec
# Make sure you have the fakes3 gem installed
group :test do
gem 'fakes3'
end
@bjallen
bjallen / main.yml
Created September 10, 2014 21:13
ansible mysql percona task
---
- name: Add Percona apt signing key
sudo: yes
apt_key: keyserver=keys.gnupg.net id=1C4CBDCDCD2EFD2A state=present
- name: Add Percona repository
sudo: yes
apt_repository: repo='deb http://repo.percona.com/apt trusty main' state=present
- name: Add Percona source repository
@ricardo-rossi
ricardo-rossi / ElasticSearch.sh
Last active December 1, 2023 04:55
Installing ElasticSearch on Ubuntu 14.04
#!/bin/bash
### USAGE
###
### ./ElasticSearch.sh 1.7 will install Elasticsearch 1.7
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
@allaire
allaire / puma.rake
Created May 27, 2014 00:44
Puma with foreman upstart
namespace :load do
task :defaults do
set :puma_init_name, "#{fetch(:application)}-web"
set :puma_pid_path, "#{shared_path}/tmp/pids/puma.pid"
end
end
namespace :puma do
desc "Start puma workers"
task :start do
@ghilead
ghilead / create_es_combined_index.rake
Last active January 18, 2019 12:08
Rake task for collocating multiple models as types in a single index.
# A Rake tasks to facilitate importing data from your models into a common Elasticsearch index.
#
# All models should declare a common index_name, and a document_type:
#
# class Article
# include Elasticsearch::Model
#
# index_name 'app_scoped_index'
# document_type 'articles'
#