Skip to content

Instantly share code, notes, and snippets.

View bendilley's full-sized avatar

Ben Dilley bendilley

  • Skillstream Ltd
  • London, UK
View GitHub Profile
@bendilley
bendilley / conda-debug.md
Created April 1, 2025 11:59
Conda debug

If conda install hangs on "solving environment," it typically means that Conda is taking a long time to resolve dependencies for the requested package(s). This can happen for several reasons:

Common Causes:

  1. Complex Dependency Graph:

    • The requested package has many dependencies, and Conda is trying to find a compatible set of versions for all packages in the environment.
  2. Large Environment:

    • If your environment already has many installed packages, resolving dependencies can take longer.
  3. Outdated Conda:

@bendilley
bendilley / shred.bash
Created October 21, 2024 10:11
PersistentVolume Shredder
#!/bin/bash
if (( ${#@} != 1 )); then
echo -e '\nusage: shred.bash <volume_name>\n'
exit 2
fi
vol=$1
linode_vol=`echo $vol | sed -r -e 's/-//g'`
linode_vol_id=`linode-cli volumes ls | grep $linode_vol | awk '{print $2}'`
size=`kubectl get pv $vol -o "custom-columns=SIZE:.spec.capacity.storage" | tail -n +2`
@bendilley
bendilley / workflow.bash
Last active June 10, 2020 10:19
git workflow with backups
# Note that this workflow requires that the default push is to an explicit upstream:
git config --global push.default upstream
# create a personal fork of the origin repo and make it a 2nd remote:
git remote add fork [email protected]:myusername/cool_project.git
# start work on your stuff:
git checkout -b new-feature
# when you get to a point where losing your work would make you very sad:
@bendilley
bendilley / mozy_backup.md
Last active August 29, 2015 14:25
Mozy backup and restore with Linux servers
@bendilley
bendilley / trace.rb
Created February 10, 2015 17:41
Get a trace from a 'stack too deep' error in Rails
$enable_tracing = false
#$trace_out = File.open(Rails.root + 'trace.txt', 'w')
set_trace_func proc { |event, file, line, id, binding, classname|
if $enable_tracing && event == 'call'
#$trace_out.puts "#{file}:#{line} #{classname}##{id}"
raise "crash me" if caller_locations.length > 500
end
}
@bendilley
bendilley / Raspberry Pi with Meridian Explorer setup.md
Last active November 20, 2015 21:51
Raspberry Pi with Meridian Explorer setup

Raspberry Pi Meridian Explorer setup

Update firmware using rpi-update and software using apt-get dist-upgrade

Disable onboard sound by commenting it out in /etc/modules

In /etc/modprobe.d/alsa-base.conf comment-out the line

options snd-usb-audio index=-2
@bendilley
bendilley / slow_connection.sh
Last active August 29, 2015 13:56
Simulate slow connection on OS X/BSD
# set-up a narrow pipe
sudo ipfw pipe 1 config bw 350kbit/s plr 0.05 delay 500ms
# assign that pipe to all connections on port 8080
sudo ipfw add pipe 1 dst-port 8080
# delete that pipe
sudo ipfw pipe delete 1
# or just flush everything back to its original state
@bendilley
bendilley / VelocityTools2View.java
Created January 16, 2013 18:57
Spring View which supports the Velocity Tools 2.0 sub-project. Configured using the Spring Bean xml snippet below.
public class VelocityTools2View extends VelocityLayoutView {
private ViewToolManager toolManager;
@Override
protected Context createVelocityContext (Map<String, Object> model,
HttpServletRequest request,
HttpServletResponse response) {
ToolContext toolContext = toolManager.createContext(request, response);
VelocityContext context = new VelocityContext(toolContext);