Skip to content

Instantly share code, notes, and snippets.

View waltervargas's full-sized avatar
🎯
BioHacking(self)

Walter Vargas waltervargas

🎯
BioHacking(self)
View GitHub Profile
@waltervargas
waltervargas / range.c
Last active March 24, 2024 16:13
range in C
int* range(int start, int end) {
int len;
if (start <= end) {
len = end - start + 1;
} else {
len = start - end + 1;
}
int* array = malloc(sizeof(int) * len);
if (start == end){
array[0] = start;
@waltervargas
waltervargas / readme.md
Last active February 9, 2024 20:23
lima and colima

Colima vs Lima

vms created with colima cannot be managed by limactl

➜  ~ limactl list
NAME    STATUS     SSH                VMTYPE    ARCH       CPUS    MEMORY    DISK      DIR
lima    Running    127.0.0.1:54560    qemu      aarch64    4       4GiB      100GiB    ~/.lima/lima
@waltervargas
waltervargas / go.mod
Created August 13, 2022 00:48
go.mod for tinygo golsp arm
module tinygowifi
go 1.18
replace device/arm => /usr/local/lib/tinygo/src/device/arm
replace internal/reflectlite => /usr/local/lib/tinygo/src/internal/reflectlite
replace internal/task => /usr/local/lib/tinygo/src/internal/task
@waltervargas
waltervargas / plperl-rest.sql
Created May 3, 2022 17:49
REST request from PLSQL
CREATE OR REPLACE FUNCTION restful.put(auri character varying, ajson_text text)
RETURNS text
LANGUAGE plperlu
SECURITY DEFINER
AS $function$
use REST::Client;
use Encode qw(encode);
my $client = REST::Client->new();
$client->getUseragent()->proxy( 'https', 'http://some-proxy/' ); # use for proxy authentication
$client->addHeader('Content-Type', 'application/json'); # headers
@waltervargas
waltervargas / typeGenericMacrosC.md
Created May 13, 2021 13:10
Type Generic Macros in C

Type Generic Macros in C

source

#define sin(X) _Generic((X), \
   float: sinf, \
   double: sin, \
   long double: sinl \
)(X)
@waltervargas
waltervargas / predefinedmacrosinc.md
Last active May 13, 2021 13:06
Get full list of C predefined macros for a source file

Predefined Macros in C

You can get the list of predefined macros for a source file in C by using the clang or gcc flags -E -dM

λ walter [learning-c/effective-c/ch8] → clang -E -dM readchar.c 
@waltervargas
waltervargas / readchar.md
Created May 11, 2021 22:13
reading char files in C

Reading char files in C

λ walter [learning-c/effective-c/ch8] → cat > signals.txt <<EOF   
heredoc> 1 HUP   Hangup
2 INT   Interrupt
3 QUIT  Quit
4 ILL   Illegal instruction
5 TRAP  Trace trap
6 ABRT  Abort
@waltervargas
waltervargas / charfileC.md
Last active May 13, 2021 13:00
writing char files in C

Writing char files in C

cc charfile.c
λ walter [learning-c/effective-c/ch8] → ./a.out      
file position after write: 27
file position after write: 54
@waltervargas
waltervargas / aws-account-list-tf.sh
Created September 25, 2020 12:24
AWS Account List from Organization to terraform list format
aws organizations list-accounts | jq -r '.[] | .[] | [.Id, .Name] | @csv' | perl -pe 's|,|, //|'
@waltervargas
waltervargas / gen-cfn-params.sh
Created June 28, 2019 11:12
Produce CFN Parameters File from Template with JQ
cat template.json | jq '.Parameters | [ to_entries[] | {ParameterKey: .key, ParameterValue: ""} ]'