Skip to content

Instantly share code, notes, and snippets.

@akloboucnik
akloboucnik / cmd.bash
Last active September 28, 2022 12:32
Download all assets in github release
# needs curl, jq
# [0] in jq means last release
curl -s https://api.github.com/repos/noxdafox/rabbitmq-cloudwatch-exporter/releases | jq -r ".[0].assets | map(.browser_download_url) | @sh" | xargs | tr " " "\n" | while read url; do curl -#LO $url;echo "$url done"; done
@akloboucnik
akloboucnik / rename_phoenix_project.sh
Created October 16, 2021 11:53 — forked from vrymel/rename_phoenix_project.sh
Command steps to rename a Phoenix project
# tested on macOS 10.12.4
# based on https://elixirforum.com/t/how-to-change-a-phoenix-project-name-smoothly/1217/6
# replace values as necessary
current_otp="hello_phoenix"
current_name="HelloPhoenix"
new_otp=""
new_name=""
git grep -l $current_otp | xargs sed -i '' -e 's/'$current_otp'/'$new_otp'/g'
@akloboucnik
akloboucnik / rtt_logger.rs
Created September 8, 2020 08:59
rtt logger implementation
struct RttLogger<P: core::fmt::Write> {
pub inner: P,
pub level: log::LevelFilter,
}
#[cfg(all(feature = "debug", feature = "use_rtt"))]
impl<P: core::fmt::Write + core::marker::Send + core::marker::Sync> log::Log for RttLogger<P> {
fn enabled(&self, metadata: &Metadata) -> bool {
// metadata.level() <= self.level
true

Keybase proof

I hereby claim:

  • I am akloboucnik on github.
  • I am klob (https://keybase.io/klob) on keybase.
  • I have a public key whose fingerprint is 3CBF 154D FF36 8777 BBB2 0BEA F83D 368E 0744 A024

To claim this, I am signing this object:

@akloboucnik
akloboucnik / uploadToInstance.sh
Created February 12, 2015 14:50
Upload to instance
#!/bin/bash
# use to upload files in opt common to instance
# to usage with fswatch tool use like this:
# - copy to repository root
# - run: fswatch -0 . | xargs -0 -n1 -I {} ./uploadToInstance.sh {} akl-aa
#
# $1 - path to changed file
# $2 - instance hostname
# remove afplay part if not on mac
@akloboucnik
akloboucnik / notebook.ipynb
Last active January 2, 2016 09:09
Pandas 010
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@akloboucnik
akloboucnik / fabfile.py
Last active January 2, 2016 02:28
JSBin deployment
from fabric.api import settings, run, cd
from fabric.state import env
from fabric.contrib.console import confirm
from fabric.context_managers import shell_env
from os import urandom
# yum install node sqlite-devel gcc-c++
def install_rpms():
# TODO check if installed first
run('yum -y install node sqlite-devel gcc-c++')
@akloboucnik
akloboucnik / gist:3003682
Created June 27, 2012 12:11
Blank Favicon
<link href="data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAAF0lEQVRIx2NgGAWjYBSMglEwCkbBSAcACBAAAeaR9cIAAAAASUVORK5CYII=" rel="icon" type="image/x-icon" />