Skip to content

Instantly share code, notes, and snippets.

View chrisjones-brack3t's full-sized avatar

Chris Jones chrisjones-brack3t

View GitHub Profile
@chrisjones-brack3t
chrisjones-brack3t / info.md
Last active July 27, 2022 18:15
Kubernetes copy file to/from pod

How to Download/Upload a file to a running Kubernetes pod.

Download a file

kubectl --context=dev-gke --namespace=loon cp <pod>:<file> <local_file_name>

Example:

kubectl --context=dev-gke --namespace=videometadataservice cp http-6c56fbc86b-jg7tt:file.txt file.txt

WSL 2 Cisco AnyConnect Networking Workaround

Overview

WSL 2 uses a Hyper-V Virtual Network adapter. Network connectivity works without any issue when a VPN is not in use. However when a Cisco AnyConnect VPN session is established Firewall Rules and Routes are added which breaks connectivity within the WSL 2 VM. This issue is tracked WSL/issues/4277

Below outline steps to automatically configure the Interface metric on VPN connect and update DNS settings (/etc/resolv.conf) on connect/disconnect.

Manual Configuration

Set Interface Metrics

@chrisjones-brack3t
chrisjones-brack3t / local.py
Created October 2, 2015 18:21
Disable migrations during tests
class DisableMigrations(object):
def __contains__(self, item):
return True
def __getitem__(self, item):
return 'notmigrations'
# ENABLE THIS TO SPEED UP TESTS
MIGRATION_MODULES = DisableMigrations()
@chrisjones-brack3t
chrisjones-brack3t / hello.go
Created September 28, 2015 21:47
Simple test of micropackage
package hello
import "fmt"
// SayHello says hello!
func SayHello() {
fmt.Println("HELLO!")
}
class SSLRequiredMixin(object):
""" """
raise_exception = False # Default whether to raise an exception to none
def dispatch(self, request, *args, **kwargs):
# if getattr(settings, 'DEBUG', False):
# return super(SSLRequiredMixin, self).dispatch(
# request, *args, **kwargs)
if not request.is_secure():

Keybase proof

I hereby claim:

  • I am chrisjones-brack3t on github.
  • I am tehjones (https://keybase.io/tehjones) on keybase.
  • I have a public key whose fingerprint is D209 4832 7A84 0EA7 6BBF D255 4017 BB41 9BD6 AE7B

To claim this, I am signing this object:

@chrisjones-brack3t
chrisjones-brack3t / example.swift
Created December 16, 2014 05:57
Passing objects
# Inside table view
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let game = self.games[self.tableView.indexPathForSelectedRow()!.row]
var detailView = segue.destinationViewController as GameDetailView
detailView.game = game
}
# Detail View
import UIKit
import UIKit
class SettingsTableViewController: UITableViewController {
let items: [String] = ["Some", "Text", "For", "The", "Cells"]
override func viewDidLoad() {
super.viewDidLoad()
let tableCell = UITableViewCell.self
tableView.registerClass(tableCell, forCellReuseIdentifier: "cell")
regex = ur'(\s|\=|\(|\[|\{)[u]{0}(\'|\")(?!\"\")(?!\'\')'
#!/bin/bash
#
# Install Postgres 9.2 on a clean Ubuntu 12.04
"""
LC_ALL issue
comment out the AcceptEnv LANG LC_* line in the remote /etc/ssh/sshd_config file.
sudo apt-get install language-pack-en-base
sudo dpkg-reconfigure locales
comment out the SendEnv LANG LC_* line in the local /etc/ssh/ssh_config file.