Skip to content

Instantly share code, notes, and snippets.

View siddhesh's full-sized avatar

Siddhesh Poyarekar siddhesh

View GitHub Profile
@siddhesh
siddhesh / packagesize.py
Created October 6, 2022 19:19
For a tree of copr packages builds done with mass-prebuilder, record the rpm size along with the corresponding build in koji.
#!/usr/bin/python3
import json
import requests
import sys
import os
def eprint(inp):
#print(inp)
return
@siddhesh
siddhesh / build-worktree.sh
Created January 12, 2022 03:43
Helper script to build a branch+target combination for gcc.
#!/bin/bash
worktree_root=PATH_TO/gcc-worktrees
gcc_root=$worktree_root/gcc
if [ -z $1 ]; then
echo "Usage: $0 <git commit ref> [target]"
exit 1
fi
ref=$1
@siddhesh
siddhesh / test-gcc-bdos.sh
Last active December 1, 2021 04:52
Test gcc implementation of __builtin_dynamic_object_size on Fedora package builds
#!/bin/bash
# This is only intended to be used inside a scratch VM or test machine to build
# Fedora packages with _FORTIFY_SOURCE=3 to compare fortification with the
# current build. The script needs to be run as root since it installs packages.
set -ex
uid=$(id -u)
if [ $uid -ne 0 ]; then
#!/bin/bash
# Run this from within the repo. Tested with glibc.
# This is what I have in my glibc git-config
#
# [pw]
# server = https://patchwork.sourceware.org/api/1.2/
# project = glibc
# username = <my username>
# password = <my password>
# states = committed,accepted,superseded,deferred,rejected
@siddhesh
siddhesh / GetMF.gs
Last active November 26, 2021 18:46
Handy Google spreadsheet function to download and parse NAVs uploaded regularly by the AMFI.
// This code is in Public domain.
MF_SCHEME_NAME = 3;
MF_NAV = 4;
MF_DATE = 5;
CACHE_NAME = '_mfcache';
function initNAV() {
var response = UrlFetchApp.fetch("http://portal.amfiindia.com/spages/NAVAll.txt");
var txt = response.getContentText();
@siddhesh
siddhesh / fixup-contributed-by.py
Last active August 10, 2021 17:23
Clean up raw CONTRIBUTED-BY output into something nicer looking
# The raw CONTRIBUTED-BY file was generated by editing all files to remove the
# Contributed by lines and then running the following command:
#
# git diff -U1 | grep "^-" | sed -e 's/--- a\/\(.*\)/\1:/' -e 's/^-\(.*\)/\1\n/' >> CONTRIBUTED-BY
credit = {}
with open('CONTRIBUTED-BY', 'r') as contrfile:
curkey = ''
credit[''] = ''
@siddhesh
siddhesh / glibc_contrib_filter.py
Created August 10, 2021 17:18
Filter out files to feed into several regular expressions to remove "Contributed by", "Written by", etc. notices.
from glibc_shared_code import get_glibc_shared_code
import os
import stat
import re
shared_code = ['./' + f for f in
sum(get_glibc_shared_code('SHARED-FILES').values(), [])]
exclude_patterns = [
r'.*ChangeLog.*',
@siddhesh
siddhesh / process_accesslog.py
Last active October 11, 2019 19:08
Read one or more httpd access.log files and print statistics I care about.
# Simple script to read httpd access.log and print a couple of statistics I care
# about. Usage:
#
# python3 process_accesslog.py <one or more log files>
#
# Copyright (c) 2019 Siddhesh Poyarekar
#
# This code is released under the MIT license:
# http://www.opensource.org/licenses/mit-license.php