Skip to content

Instantly share code, notes, and snippets.

kl()
local key="$1"
local namespace="${2:-production}" # Default to production if no namespace is provided
local pod_names
local selected_pods=()
# Find the pod names based on the key
pod_names=($(kubectl get pod -n "$namespace" | grep "$key" | awk '{print $1}'))
if [[ ${#pod_names[@]} -eq 0 ]]; then
@jfarcand
jfarcand / podWithChoice.zsh
Created February 29, 2024 00:18
Get the pod log
kl() {
local key="$1"
local namespace="${2:-production}" # Default to production if no namespace is provided
local pod_names
local selected_pod
# Find the pod names based on the key
pod_names=($(kubectl get pod -n "$namespace" | grep "$key" | awk '{print $1}'))
if [[ ${#pod_names[@]} -eq 0 ]]; then
@jfarcand
jfarcand / logback.xml
Created August 25, 2020 15:31
Example of configuration
<configuration debug='true'>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>
</encoder>
</appender>
<logger name="org.atmosphere.interceptor.OnDisconnectInterceptor" level="TRACE"/>
<logger name="org.atmosphere.cache.UUIDBroadcasterCache" level="TRACE"/>
@jfarcand
jfarcand / ngrep_hack.md
Last active May 29, 2018 18:07
Fixing broken ngrep with OS X Mavericks

Migrating to OS X Mavericks breaks the ngrep utility. Doing:

sudo ngrep -d lo0 -q -W byline port 8080

stopped working where the process exits immediately. I didn't dig into the ngrep code, but was able to find a simple workaround by doing

sudo ngrep -q -W byline -d lo0 '' 'port 8080'

You can call that a lazy hack, but it work!

@jfarcand
jfarcand / gist:8673186
Last active October 3, 2017 14:52
Primefaces Push 5.0
/*
* Copyright 2013 Jeanfrancois Arcand
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@jfarcand
jfarcand / java
Created February 5, 2015 16:13
Jetty 9 with Atmosphere
public class Main {
private static final Logger log = LoggerFactory.getLogger(Main.class);
public static void main(String[] args) throws Exception {
Main main = new Main();
main.run();
}
private void run() throws Exception {
Server server = new Server();
@jfarcand
jfarcand / gist:9939499
Created April 2, 2014 17:58
Atmosphere Pro Repository
<repositories>
<repository>
<id>async-io</id>
<name>maven-repo</name>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
Magneto:gwt20-managed-rpc jfarcand$ rm -rf target/
Magneto:gwt20-managed-rpc jfarcand$ mvn install gwt:run
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.atmosphere.samples:gwt20-managed-rpc:war:2.1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.eclipse.jetty:jetty-maven-plugin is missing. @ org.atmosphere:atmosphere-samples-project:2.1.0-SNAPSHOT, /Users/jfarcand/workspace/atmosphere-samples/pom.xml, line 101, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
08:48:57.961 INFO [main] o.a.c.AtmosphereFramework [AtmosphereFramework.java:779] Atmosphere is using async support: org.atmosphere.container.Jetty9AsyncSupportWithWebSocket running under container: jetty/9.1.1.v20140108 with WebSocket enabled.
08:48:57.962 INFO [main] o.a.c.AtmosphereFramework [AtmosphereFramework.java:781] Atmosphere Framework 2.1.0-SNAPSHOT started.
08:48:57.962 INFO [main] o.a.c.AtmosphereFramework [AtmosphereFramework.java:783]
For Atmosphere Framework Commercial Support, visit
http://www.async-io.org/ or send an email to support@async-io.org
2014-01-14 08:48:57.969:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@26a549a8{/atmosphere-chat,file:/private/var/folders/lq/7wssqgvd6jzdwbt0vg06j8yc0000gn/T/jetty-0.0.0.0-8080-atmosphere-chat.war-_atmosphere-chat-any-368035570580900042.dir/webapp/,AVAILABLE}{/Users/jfarcand/workspace/containers/shared_webapps/atmosphere-chat.war}
2014-01-14 08:48:57.985:INFO:oejs.ServerConnector:main: Started ServerConnector@518bc6a4{HTTP/1.1}{0
@jfarcand
jfarcand / gist:8418528
Created January 14, 2014 13:47
Atmosphere + Jetty 9.1.0
08:46:44.732 INFO [main] o.a.c.AtmosphereFramework [AtmosphereFramework.java:779] Atmosphere is using async support: org.atmosphere.container.Jetty9AsyncSupportWithWebSocket running under container: jetty/9.1.0.v20131115 with WebSocket enabled.
08:46:44.734 INFO [main] o.a.c.AtmosphereFramework [AtmosphereFramework.java:781] Atmosphere Framework 2.1.0-SNAPSHOT started.
08:46:44.734 INFO [main] o.a.c.AtmosphereFramework [AtmosphereFramework.java:783]
For Atmosphere Framework Commercial Support, visit
http://www.async-io.org/ or send an email to support@async-io.org
2014-01-14 08:46:44.735:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@2feea189{/atmosphere-chat,file:/private/var/folders/lq/7wssqgvd6jzdwbt0vg06j8yc0000gn/T/jetty-0.0.0.0-8080-atmosphere-chat.war-_atmosphere-chat-any-8278089751165587569.dir/webapp/,AVAILABLE}{/Users/jfarcand/workspace/containers/shared_webapps/atmosphere-chat.war}
2014-01-14 08:46:44.750:INFO:oejs.ServerConnector:main: Started ServerConnector@5332f20b{HTTP/1.1}{