Skip to content

Instantly share code, notes, and snippets.

@rindeal
rindeal / gist:8c862f576036dd58e46d
Created September 19, 2014 16:25
Github Bigquery - get all merged PR's of a specific user
SELECT created_at,
repository_name,
payload_pull_request_title,
payload_pull_request_issue_url ,
repository_description,
repository_language,
repository_url
FROM [githubarchive:github.timeline]
WHERE TYPE="PullRequestEvent"
AND payload_pull_request_head_repo_owner_login="USERNAME"
@rindeal
rindeal / opkg-link.sh
Created November 11, 2014 12:53
OpenWrt external storage package linker
@rindeal
rindeal / process-tmpl.sh
Last active August 29, 2015 14:11
pure BASH template processor
#!/bin/bash
# http://stackoverflow.com/a/2916159/2566213
PATTERN=(.*)(\$\{([a-zA-Z_][a-zA-Z_0-9]*)\})(.*)
line="$(cat; echo -n a)"
end_offset=${#line}
while [[ "${line:0:$end_offset}" =~ $PATTERN ]] ; do
PRE="${BASH_REMATCH[1]}"
@rindeal
rindeal / dnsmasq-info.sh
Last active September 30, 2015 10:57
Script to retrieve info about a dnsmasq instance
#!/bin/sh
# usage:
# - $0 # queries the default server
# - $0 NAMESERVER_IP # queries the provided server
# ------------------------------------------------------------------------------
# Example output:
# dnsmasq : 127.0.1.1
# servers : 8.8.8.8#53 216 1 # template: "IP#port valid_responses invalid_responses"
# cachesize : 10000
# insertions: 9876
@rindeal
rindeal / cpuid-dump.c
Last active November 11, 2023 16:32
CPUID dumper
#if !defined(__GNUC__) || ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800)
# error "This program requires GNU C compiler v4.8+!"
#endif
#include <stdio.h>
#include <stdbool.h>
#define PRINT_TEST_CPU_SUPPORT_RESULT(inst) printf("\t%-7s: %d\n", inst, __builtin_cpu_supports(inst)?1:0)
#define PRINT_TEST_CPU_TYPE_RESULT(inst) printf("\t%-12s: %d\n", inst, __builtin_cpu_is(inst)?1:0)
@rindeal
rindeal / uncrustify-c-cpp.cfg
Last active May 20, 2022 05:11
Uncrustify C/C++ config
# -------------------------------------------------------------------------------------------------#
# #
# _ _ _ _ __ ___ _____ _ _ __ _ #
# | | | |_ _ __ _ _ _ _ __| |_(_)/ _|_ _ / __| / / __|| |_ _| |_ __ ___ _ _ / _(_)__ _ #
# | |_| | ' \/ _| '_| || (_-< _| | _| || | | (__ / / (_|_ _|_ _| / _/ _ \ ' \| _| / _` | #
# \___/|_||_\__|_| \_,_/__/\__|_|_| \_, | \___/_/ \___||_| |_| \__\___/_||_|_| |_\__, | #
# |__/ |___/ #
# #
# -------------------------------------------------------------------------------------------------#
# #
@rindeal
rindeal / opcode.sh
Last active December 28, 2016 11:21
opcode.sh - Searches disassembled code for specific instructions.
#!/bin/bash
#
# Last update on Nov 05, 2014.
#
# Searches disassembled code for specific instructions.
#
# Opcodes obtained from: https://github.com/Shirk/vim-gas/blob/master/syntax/gas.vim
#
# List of opcodes has been obtained using the following commands and making a few modifications:
# echo '#!/bin/bash' > Opcode_list
@rindeal
rindeal / screenfetch_all.sh
Created May 22, 2015 01:10
Runs screenfetch utility for all known distros
#!/bin/bash
DISTROS=()
DISTROS+=('Antergos')
DISTROS+=('Arch Linux')
DISTROS+=('Arch Linux - Old')
DISTROS+=('BLAG')
DISTROS+=('CentOS')
DISTROS+=('Chakra')
@rindeal
rindeal / leap.c
Last active July 2, 2020 16:57
IsLeapYear()
#include <stdbool.h>
#include <assert.h>
/**
* Modified version of https://stackoverflow.com/a/11595914/2566213
* with 4000th check added.
*/
bool
IsLeapYear(const int y)
{
@rindeal
rindeal / wrapper.sh
Last active March 13, 2016 19:09
ar/nm/ranlib wrapper for LTO
#!/bin/sh
DEBUG=0
[ "${DEBUG}" -eq 1 ] && set -x
CC=${CC:-"/usr/bin/gcc"}
lto_wrapper="$( $CC -v 2>&1 | /bin/awk -F= '/COLLECT_LTO_WRAPPER/{print $2}' )"
plugin_dir="${lto_wrapper%/*}"
util="${0##*/}"