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 / funcPointers.c
Last active February 9, 2019 22:57
C function pointers
#include <stdio.h>
#include <stdlib.h>
#define safeFree(p) saferFree((void**)&(p))
void saferFree(void **pp) {
if (pp != NULL && *pp != NULL) {
free(*pp);
*pp = NULL;
}
}
@waltervargas
waltervargas / csv2json.sh
Last active October 27, 2018 01:12
csv to json in bash
#!/bin/sh
_csv () {
cat /dev/stdin <<EOF
"text/html","gzip","en;q=0.5","close","httpbin.org","1","curl","20"
"text/html","gzip","en;q=0.5","close","httpbin.org","1","curl","20"
"text/html","gzip","en;q=0.5","close","httpbin.org","1","curl","20"
"text/html","gzip","en;q=0.5","close","httpbin.org","1","curl","20"
"text/html","gzip","en;q=0.5","close","httpbin.org","1","curl","20"
EOF
@waltervargas
waltervargas / json_check.sh
Created October 26, 2018 16:02
Bash JSON check
#!/bin/sh
_json_valid(){
local _STD_OUT_ERR
_STD_OUT_ERR=$( { jq type /dev/stdin <<< "${1}"; } 2>&1 )
}
read -d '' -r _JSON <<EOB
{"widget": {
"debug": "on",
@waltervargas
waltervargas / duplicity-s3.sh
Last active September 26, 2018 22:31
duplicity backup to s3
#!/bin/sh
HOSTNAME=$(hostname)
BUCKET="walterve-devops"
PREFIX="backups/${HOSTNAME}"
duplicity full \
--verbosity info \
--s3-use-new-style \
--s3-use-multiprocessing \
@waltervargas
waltervargas / caesar-crack.hs
Created April 30, 2018 11:43
Caesar Crack Haskell Example
import Data.Char
positions :: Eq a => a -> [a] -> [Int]
positions x xs = [i | (x', i) <- zip xs [0..], x==x']
lowers :: String -> Int
lowers xs = length [x | x <- xs, x >= 'a' && x <= 'z']
count :: Char -> String -> Int
count x xs = length [x' | x' <- xs, x == x']
Surfi.prototype.start_tunnel = function () {
var socks5 = this.config.socks5;
var ssh_conf = {
host: this.config.proxy.host,
port: this.config.proxy.port,
username: this.config.proxy.user,
privateKey: this.config.proxy.key
//debug: function (e) { console.log(e)}
};
@waltervargas
waltervargas / pulseaudio-debian-macbook.txt
Last active March 13, 2018 23:59
Debian Pulseaudio details
❯ pactl list
Module #0
Name: module-device-restore
Argument:
Usage counter: n/a
Properties:
module.author = "Lennart Poettering"
module.description = "Automatically restore the volume/mute state of devices"
module.version = "10.0"
@waltervargas
waltervargas / osx-bootstrap.sh
Last active March 2, 2018 14:32
My osx bootstrap
brew install git
brew install zsh
brew install tmux --HEAD
brew cask install iterm2
brew install node
brew install jq
brew install gpg
brew install opensc
brew install ccze # colorize logs: tail -f .msmtp.log | ccze -A
brew cask install spectacle # manage windows
---
AWSTemplateFormatVersion: '2010-09-09'
Description: Jenkins Bootstrapping Template
Metadata:
Version: '0.0.1'
Stack: 0
AWS::CloudFormation::Interface:
ParameterGroups:
- Parameters:
- StackPrefix
autoload colors; colors
rc=$reset_color
EDITOR=ec
export WALTERBIO_PATH=$HOME/git/walter.bio
function init {
cd $HOME/git/walter.bio
print -- $fg[magenta]\❁ $fg[yellow]"Initializing walter.bio" $rc