Skip to content

Instantly share code, notes, and snippets.

View tuxpower's full-sized avatar

José Gaspar tuxpower

  • Porto, Portugal
View GitHub Profile
@tuxpower
tuxpower / baseURL.groovy
Created September 19, 2023 09:29 — forked from nigimaster/baseURL.groovy
This is a collection of groovy scripts I gathered and use for bootstrapping Jenkins. Most of this can also be achieved with the CasC Plugin https://github.com/jenkinsci/configuration-as-code-plugin
#!groovy
/*
* This script configures the Jenkins base URL.
*/
import jenkins.model.JenkinsLocationConfiguration
JenkinsLocationConfiguration location = Jenkins.instance.getExtensionList('jenkins.model.JenkinsLocationConfiguration')[0]
location.url = 'https://jenkins-as-code-poc.devtail.io/'
@tuxpower
tuxpower / ml-recs.md
Created March 21, 2022 09:51 — forked from bsletten/ml-recs.md
Machine Learning Path Recommendations

This is an incomplete, ever-changing curated list of content to assist people into the worlds of Data Science and Machine Learning. If you have a recommendation for something to add, please let me know. If something isn't here, it doesn't mean I don't recommend it, I just may not have had a chance to review it yet or not.

I will generally list things in order of easier to more formal/challenging content.

It may feel like there is an overwhelming amount of stuff for you to learn (because there is). But, there is a guided path that will get you there in time. You need to focus on Linear Algebra, Calculus, Statistics and probably Python (or R). Your best bet is to get a Safari Books Online account (https://www.safaribooksonline.com) which you may already have access to through school or work. If not, it is a reasonable way to get access to a tremendous number of books and videos.

I'm not saying you will get what you need out of everything here, but I have read/watched at least some of all of the following an

@tuxpower
tuxpower / Makefile
Created October 14, 2018 10:24 — forked from prwhite/Makefile
Add a help target to a Makefile that will allow all targets to be self documenting
# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
help: ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
# Everything below is an example
target00: ## This message will show up when typing 'make help'
@echo does nothing

Preventing users from using shell escapes

Certain programs, especially text editors and pagers, have a handy shell escape feature. This allows a user to run a shell command without having to exit the program first. For example, from the command mode of the Vi and Vim editors, someone could run the ls command by doing :!ls.

You can fix this problem by having sudoedit instead of vim:

<USERNAME>     ALL=(ALL)     sudoedit /etc/ssh/sshd_config

Tired of updating your IP address manually in the security group eveytime you need to access a EC2 instance? Look no further :)

TL;DR

$ mkdir ~/.aws/cli

$ cat >> ~/.aws/cli/alias

update-ssh-ip =
@tuxpower
tuxpower / bumpme
Last active August 10, 2018 10:21
Fri Aug 10 10:20:59 UTC 2018
ssh -i ~/.ssh/aws_key -o ProxyCommand='ssh -i ~/.ssh/id_bastion -W %h:%p user@bastion' ec2-user@aws-instance
https://www.nadeau.tv/ssh-with-a-bastion-host/
@tuxpower
tuxpower / Memcached.md
Last active February 6, 2018 09:14
Memcache in code using PHP
<?php
$memcache = new Memcache();
$memcache->addServer(‘172.16.0.1’, 11211);
$memcache->addServer(‘172.16.0.2’, 11211);

$myData = $memcache->get(‘myKey’);
if ($myData == false) {
   $myData = GetMyDataFromDB();
 // Put it in Memcache as ‘myKey’, without compression, with no expiration
@tuxpower
tuxpower / ec2-describe-instances.go
Created February 1, 2018 13:24 — forked from farrellit/ec2-describe-instances.go
golang awssdk ec2 describe-instances
package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
)
func main() {

Keybase proof

I hereby claim:

  • I am tuxpower on github.
  • I am jgaspar (https://keybase.io/jgaspar) on keybase.
  • I have a public key whose fingerprint is 9D41 EB64 1AFD 166C 7D5C 5F2F 693F B4FE 3BF4 447F

To claim this, I am signing this object: