Skip to content

Instantly share code, notes, and snippets.

View zedtux's full-sized avatar

Guillaume Hain zedtux

View GitHub Profile
@zedtux
zedtux / gist:1951710
Created March 1, 2012 18:00
ioctocat debug logs when receiving "Could not load the feed."
GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Thu Nov 3 21:59:02 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".Attaching to process 58085.
2012-03-01 18:59:02.097 iOctocat[58085:15203] (07f5ed60.0092)-[GHResource loadData] Loading https://api.github.com/user
====
@zedtux
zedtux / capybara.rb
Created March 16, 2018 06:47
Capybara configuration to be used with the SeleniumHQ/docker-selenium Docker image (https://github.com/SeleniumHQ/docker-selenium)
# Capybara defaults to CSS3 selectors rather than XPath.
# If you'd prefer to use XPath, just uncomment this line and adjust any
# selectors in your step definitions to use the XPath syntax.
# Capybara.default_selector = :xpath
Capybara.register_driver :chrome do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: {
args: [
'--disable-default-apps',
@zedtux
zedtux / mysql-debug-pod.yaml
Created November 21, 2019 16:02
Kubernetes Debug pod to access PV from PVC name
apiVersion: v1
kind: Pod
metadata:
name: mysql-debug
spec:
containers:
- name: mysql-debug
image: mysql:5.7
command:
- sleep
@zedtux
zedtux / apt.conf
Created February 18, 2014 05:20
Nginx configuration for reprepro
server {
listen *:80;
server_name repository.votre-serveur.com;
server_tokens off;
root /srv/reprepro;
autoindex on; # Permet de voir les fichiers. Commentez la ligne pour l'interdire.
access_log /var/log/nginx/repository.votre-serveur.com_access.log;
error_log /var/log/nginx/repository.votre-serveur.com_error.log;
}
@zedtux
zedtux / master.rb
Created July 29, 2019 13:23
An extracted part of a Chef recipe to deploy Kubernetes with Kubeadm logging in real-time the command output
require 'pty'
# Initialize master
ruby_block 'kubeadm init' do
block do
command = <<-CMD
kubeadm init \
--token=#{node['kubeadm']['token']} \
--pod-network-cidr=#{node['kubeadm']['pod_cidr']} \
--service-cidr=#{node['kubeadm']['service_cidr']} \
@zedtux
zedtux / master.rb
Last active July 29, 2019 13:23
An extracted part of a Chef recipe to deploy Kubernetes with Kubeadm
execute 'kubeadm init' do
command = <<-CMD
kubeadm init \
--token=#{node['kubeadm']['token']} \
--pod-network-cidr=#{node['kubeadm']['pod_cidr']} \
--service-cidr=#{node['kubeadm']['service_cidr']} \
--service-dns-domain=#{node['kubeadm']['dns_domain']} \
--apiserver-advertise-address=#{node['kubeadm']['api_ip_address']}
CMD
action :run
@zedtux
zedtux / sidekiq_override_delete_by_value.rb
Last active June 27, 2019 21:02
Overrides of the Sidekiq method to delete a job, transmit via ActionCable to the UI
require 'sidekiq/api'
module Sidekiq
class JobSet < SortedSet
alias :old_delete_by_value :delete_by_value
def delete_by_value(name, value)
parsed = JSON.parse(value)
CommisChannel::BackgroundTasks.broadcast_delete(parsed['jid'])
let ws = new WebSocket('wss://ws.domain.eu/cable/', ['actioncable-v1-json']);
ws.onopen = () => { console.log('WS Open') };
ws.onerror = (error) => { console.log('WS ERROR:', error) };
ws.onclose = () => { console.log('WS CLOSED') };
ws.onmessage = (message) => { console.log('WS message:', message) };
@zedtux
zedtux / do-volume.yaml
Created February 1, 2019 05:16
Kubernetes volume YAML file for DigitalOcean volumes
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: csi-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
@zedtux
zedtux / gitlab-ci-create_secret-function.sh
Last active January 25, 2019 11:54
Updated Gitlab CI create_secret function for Kubernetes solving the authentication issue to pull the images
#
# In order to get Kubernetes to be authorised to fetch the Docker images from
# the private gitlab registry, we are creating a docker-registry secret.
#
function create_gitlab_registry_secret() {
echo "Creating the gitlab-registry secret ..."
# Save the JSON to create the gitlab-registry docker-registry secret
GITLAB_REGISTRY_SECRET_JSON=$(
kubectl create secret --namespace=$KUBE_NAMESPACE \
docker-registry gitlab-registry \