Skip to content

Instantly share code, notes, and snippets.

@ashwinvis
ashwinvis / shell.nix
Created February 28, 2022 11:04
Execute rootless Docker to build conda-forge recipes locally via `nix-shell`
# Copyright 2022 Ashwin V. Mohanan
#
# 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 distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
{ pkgs ? import <nixpkgs> {} }:
@ashwinvis
ashwinvis / already_included_in_glossario.xsh
Last active September 30, 2021 13:39
Check if a term is already included in glossario
#!/usr/bin/env xonsh
# Requires: xonsh, awk
# git clone https://github.com/carpentries/glosario
# cd glossario
# xonsh already_included_in_glossario.xsh
slugs = [
name.strip()
@ashwinvis
ashwinvis / THANKS.md
Last active July 7, 2020 05:22
GitHub Retro
@ashwinvis
ashwinvis / conda2pip.sh
Created April 2, 2020 12:11
Conda packages to pip packages convertor
#!/bin/bash
conda env export > environment.yml
# exclude pure python packages
grep -v .*=py..$ environment.yml > conda_environment.yml
# extract pure python packages under - pip:
grep .*=py..$ environment.yml | awk -F= '{print " "$1"=="$2}' >> conda_environment.yml
@ashwinvis
ashwinvis / LU_decomposition.ipynb
Created March 9, 2020 12:29 — forked from jfpuget/LU_decomposition.ipynb
A Speed Comparison Of C, Julia, Python, Numba, and Cython on LU Factorization
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ashwinvis
ashwinvis / en_SE
Created January 8, 2020 06:03 — forked from bmaupin/en_SE
en_SE locale
escape_char /
comment_char %
% This file was generated by taking the LC_TIME section from en_US and
% replacing date/time representation with that of sv_SE from the glibc
% locale sources
% (http://sourceware.org/git/?p=glibc.git;a=tree;f=localedata/locales;hb=HEAD)
% (https://www.gnu.org/software/libc/manual/html_node/Formatting-Calendar-Time.html)
% This file is part of the GNU C Library and contains locale data.
@ashwinvis
ashwinvis / fizzbuzz.py
Created July 29, 2019 20:20
A Fizzbuzz implementation: modular and extensible
lookup = {3: "Fizz", 5: "Buzz"}
def is_multiple(n, m):
return n % m == 0
def fizzbuzz(n):
output = ""
for m, string in lookup.items():
@ashwinvis
ashwinvis / following.ipynb
Last active July 13, 2019 18:44
View statistics and organize your Mastodon following into lists
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ashwinvis
ashwinvis / unstar_github.py
Created July 9, 2019 21:12
Unstar Github
# coding: utf-8
"""
Ref
---
* https://pygithub.readthedocs.io/en/latest/introduction.html#very-short-tutorial
If you are using an access token to circumvent 2FA, make sure you have
enabled "repo" scope
Troubleshooting
@ashwinvis
ashwinvis / math.md
Created April 16, 2019 07:01
Markdown + latex

Markdown stuff

import this

Inline equations

$\Sigma_{i=0}^\infty \frac{1}{n} = 2$ is a fact. However: