Skip to content

Instantly share code, notes, and snippets.

@truatpasteurdotfr
truatpasteurdotfr / bootstrap-c6-bazel-from-c7.def
Created March 16, 2017 21:12
singularity definition to build a centos6 container from a centos7 host
#!/bin/bash
#
# Copyright (c) 2015-2016, Gregory M. Kurtzer. All rights reserved.
#
# "Singularity" Copyright (c) 2016, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt of any
# required approvals from the U.S. Dept. of Energy). All rights reserved.
#
# Tru Huynh <[email protected]>
global glob
import glob, re
class dstat_scboot(dstat):
def __init__(self):
self.name = 'scboot monitor'
self.format = ('d', 6, 100)
self.vars = ('count', 'kernel', 'fabric', 'preinit', 'slurm')
self.nick = ('secs', 'kernel', 'fabric', 'initfs', 'slurm')
#self.vars = ('count', 'kernel', 'fabric', 'preinit', 'slurm', 'logins')
@grimzy
grimzy / git-pull-all
Created September 15, 2017 02:15
Git pull all remote branches
#!/usr/bin/env bash
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
@bmwant
bmwant / ansbile_tips.yml
Last active July 9, 2021 09:53
ansible quick tips for some modules
# Check existing
- name: Ansible check file exists.
stat:
path: /etc/filename
register: file_status
- debug:
msg: "File exists..."
when: file_status.stat.exists
- debug:
msg: "File not found"
#!/usr/bin/env bash
set -x
if ! which brew; then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
brew analytics off
@ozancaglayan
ozancaglayan / slurm_aliases.rc
Last active April 23, 2024 12:43
Aliases for SLURM
###############
# SINFO aliases
###############
# Detailed sinfo
alias si="sinfo -o '%8P %10n %.11T %.4c %.8z %.6m %12G %10l %10L %10O %20E' -S '-P'"
# sinfo only on GPU partition
alias sig="si -p gpu"
# sinfo only on CPU partition
alias sic="si -p cpu"
@truatpasteurdotfr
truatpasteurdotfr / grepcidr.spec
Created April 9, 2018 07:33
grepcidr spec file
Name: grepcidr
Version: 2.0
Summary: grepcidr 2.0 - Filter IPv4 and IPv6 addresses matching CIDR patterns
Group: Applications/Productivity
URL: http://www.pc-tools.net/unix/grepcidr/
Source: http://www.pc-tools.net/files/unix/grepcidr-2.0.tar.gz
Vendor: Jem Berkes <[email protected]>
Packager: Tru Huynh <[email protected]>
License: GPLv3
Release: 1%{?dist}
@ejmr
ejmr / git-ls-github-repos.sh
Created May 15, 2018 17:55
Display URLs for all public GitHub repositories of a given user
#!/bin/sh
#
# git-ls-github-repos(1) - list a user's GitHub repositories
# ==========================================================
#
# ## SYNOPSIS
#
# `git-ls-github-repos` <user>
#
# ## REQUIREMENTS
@pansapiens
pansapiens / .bashrc
Last active July 26, 2024 00:58
Some SLURM aliases
alias default_account='sacctmgr --parsable2 show user -s andrewpe | tail -1 | cut -f 2 -d '\''|'\'''
alias fairshare='sshare -a --accounts $(default_account)'
alias jhistory='sacct -u ${USER} --starttime $(date -d "-1 month" +%Y-%m-%d) --format=User,JobID,Jobname,partition,state,exitcode,time,start,end,elapsed,MaxRss,MaxVMSize,nnodes,ncpus,nodelist'
alias jshow='scontrol show job'
alias jinfo='sacct --starttime $(date -d "-1 month" +%Y-%m-%d) --format=User,JobID,Jobname%64,partition,qos,ReqCPUS,ReqMem,state,exitcode,time,start,end,elapsed,MaxRss,MaxVMSize,nnodes,ncpus,nodelist -j'
alias node_types='sinfo -o '\''%c %m %n %R'\'' --sort '\''P'\'''
alias qhogs='sreport cluster UserUtilizationByAccount -t hours'
alias si='sinfo -o "%20P %5D %14F %8z %10c %10m %10d %11l %16f %N"'
alias sq='squeue -o "%8i %.60j %4t %10u %20q %20a %10g %20P %10Q %5D %2C %5m %11l %11L %R"'
alias squ='squeue -u $USER --format="%.18i %.9P %.60j %.8u %.8a %.2t %.10M %.6D %R"'
@coin8086
coin8086 / using-proxy-for-git-or-github.md
Last active September 21, 2025 16:28
Use Proxy for Git/GitHub

Use Proxy for Git/GitHub

Generally, the Git proxy configuration depends on the Git Server Protocol you use. And there're two common protocols: SSH and HTTP/HTTPS. Both require a proxy setup already. In the following, I assume a SOCKS5 proxy set up on localhost:1080. But it can also be a HTTP proxy. I'll talk about how to set up a SOCKS5 proxy later.

SSH Protocol

When you do git clone ssh://[user@]server/project.git or git clone [user@]server:project.git, you're using the SSH protocol. You need to configurate your SSH client to use a proxy. Add the following to your SSH config file, say ~/.ssh/config:

ProxyCommand nc -x localhost:1080 %h %p