Skip to content

Instantly share code, notes, and snippets.

View adRn-s's full-sized avatar

A.s. adRn-s

View GitHub Profile
@dannguyen
dannguyen / fetch_ghstars.md
Last active April 24, 2025 10:07
fetch_ghstars.py: quick CLI script to fetch from Github API all of a user's starred repos and save it as raw JSON and wrangled CSV

fetch_ghstars.py: quick CLI script to fetch and collate from Github API all of a user's starred repos

  • Requires Python 3.6+
  • Creates a subdir 'ghstars-USERNAME' at the current working directory
  • the raw JSON of each page request is saved as: 01.json, 02.json 0n.json
  • A flattened, filtered CSV is also created: wrangled.csv

Example usage:

@jetersen
jetersen / add-cert.py
Created March 8, 2020 09:00
Python: add custom root ca to certifi store
import requests
import certifi
import sys
try:
requests.get('https://any-website-protected-by-your-custom-root-ca')
print('Certificate already added to the certifi store')
sys.exit(0)
except requests.exceptions.SSLError as err:
print('SSL Error. Adding custom certs to Certifi store...')
@federicomarini
federicomarini / iSEE_plug.R
Last active April 20, 2023 09:54
A function to wrap up the DESeq2 inputs&outputs, and plug that as SingleCellExperiment into iSEE
library(DESeq2)
wrapup_for_iSEE <- function(dds, res) {
# dds to vst
vst <- vst(dds)
# initialize the container
se <- SummarizedExperiment(
assays = List(
counts = counts(dds),
---
title: Glossary
output:
bookdown::pdf_document2:
template: two-col.latex
latex_engine: xelatex
number_sections: FALSE
toc: False
pandoc_args: ["--lua-filter", "sort_definition_list.lua"]
includes:
@RLesur
RLesur / sort_definition_list.lua
Created October 27, 2018 23:22
A pandoc lua filter that sorts definition lists
DefinitionList = function(dl)
local terms = {}
local inlines = {}
local blocks = {}
local sorted = {}
for i, item in ipairs(dl.content) do
local term = string.upper(pandoc.utils.stringify(item[1])) --string.upper() is used because all the terms were not capitalized in the example
table.insert(terms, term)
inlines[term] = item[1]
blocks[term] = item[2]
@erikw
erikw / znp
Last active September 11, 2024 21:03
znp: Wrap shell command in ZFS pre-post snapshots and log outputs.
#!/usr/bin/env bash
# Runs a command wrapped in ZFS pre-post snapshots. The whole data pool is recursively snapshotted.
# Analogous to my snp script for BTRFS: https://gist.github.com/erikw/5229436
# Usage: $ znp <commands>
# e.g.: $ znp pgk upgrade
# e.g.: $ znp portmaster -aG
# e.g.: $ znp freebsd-upgrade install
zfs_pool=zroot
@oliworx
oliworx / full-xfs-backup
Created March 25, 2016 11:57
very fast full backup of XFS partition with xfdump and lzo compression
sudo xfsdump -L KW12 -M FullBackup -J - / |lzop > /media/oli/465GB/Backup/Oli/Vostro/Linux-xfsdump-2016-03-26.lzo
## Explanation:
# sudo xfsdump
# -> start the xfsdump programm with root privileges
# -L KW12
# -> gives the Backup the label KW12
# -M FullBackup
@jumanjiman
jumanjiman / harden.sh
Last active April 27, 2025 15:00
hardening script for an alpine docker container
#!/bin/sh
# Copyright 2020 Paul Morgan
# License: GPLv2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)
set -x
set -e
#
# Docker build calls this script to harden the image during build.
#
# NOTE: To build on CircleCI, you must take care to keep the `find`
# command out of the /proc filesystem to avoid errors like:
msg <- function(..., prob = 0.25) {
if (runif(1) > prob) {
return(invisible())
}
messages <- c(...)
message(sample(messages, 1))
}
encourage <- function() {