Skip to content

Instantly share code, notes, and snippets.

View papanito's full-sized avatar

Adrian Wyssmann papanito

View GitHub Profile
foreach($level in "Machine","User") {
[Environment]::GetEnvironmentVariables($level).GetEnumerator() | % {
# For Path variables, append the new values, if they're not already in there
if($_.Name -match 'Path$') {
$_.Value = ($((Get-Content "Env:$($_.Name)") + ";$($_.Value)") -split ';' | Select -unique) -join ';'
}
$_
} | Set-Content -Path { "Env:$($_.Name)" }
}
@tnsasse
tnsasse / Jenkinsfile
Last active April 4, 2018 17:28
Jenkinsfile for Gitflow Pipeline: different deployments for dev/release/master branch
node {
checkout scm
stage('Build') {
def mvnHome = tool 'M3'
sh "${mvnHome}/bin/mvn package"
}
stage('Deploy') {
if (env.BRANCH_NAME == 'develop') {
Go to Bitbucket and create a new repository (its better to have an empty repo)
git clone git@bitbucket.org:abc/myforkedrepo.git
cd myforkedrepo
Now add Github repo as a new remote in Bitbucket called "sync"
git remote add sync git@github.com:def/originalrepo.git
Verify what are the remotes currently being setup for "myforkedrepo". This following command should show "fetch" and "push" for two remotes i.e. "origin" and "sync"
git remote -v
@OCram85
OCram85 / tag-link-snippet.md
Created January 16, 2018 08:12
Simple Jekyll Tag Linking w/o plugins (beautiful-jekyll jekyll theme)
@styx
styx / glpr.sh
Last active June 20, 2019 05:39
Create Gitlab pull request from command line
#!/bin/bash
BROWSER='google-chrome'
#GITLAB_SECRET=''
ENDPOINT='http://gitlab.activeby.net/api/v3'
PROJECT='activebilling/core'
#curl --header "PRIVATE-TOKEN: xxx" "http://gitlab.activeby.net/api/v3/projects/activebilling%2Fcore" | awk '{match($1,"[0-9]+",a)}END{print a[0]}'
PROJECT_ID=177
ACTION="projects/$PROJECT_ID/merge_requests"
CURRENT_BRANCH=`git branch | grep '^\*' | awk '{ print $2; }'`
@papanito
papanito / k8s-metricbeat.values.yaml
Last active June 9, 2020 11:58
An example `values.yaml` for installing `helm install k8s-metricbeat stable/metricbeat --namespace kube-system -f k8s-metricbeat.values.yaml`. It does not yet include shipping secret
# The instances created by daemonset retrieve most metrics from the host
daemonset:
enabled: true
podAnnotations: []
priorityClassName: ""
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
nodeSelector: {}
@Jachimo
Jachimo / README.md
Created June 2, 2018 02:29
Using ZeroTier to route between two UniFi USG LANs

Routing between two UniFi USG based LANs with ZeroTier

Intro

This is a quick explanation of how to configure both ZeroTier and two Ubiquiti UniFi USGs to allow routing between two IPv4 networks. Both networks are in private (RFC1918) address space and each one has its own DHCP service. There is no need for NAT between them, only IP routing.

The two networks are 192.168.1.0/24 (call this the "left" network) and 192.168.10.0/24 (the "right" network) but they can be anything. Also, you can have multiple CIDR blocks on one side or the other of the ZeroTier route; if you do, you just have to create more routing table entries.

@kurtis318
kurtis318 / Getting_copy-paste_working_in_Windows_10_KVM.txt
Created October 24, 2017 04:23
Getting copy/paste working in Windows 10 KVM
Found the answer to getting copy/paste working in Windows 10 KVM here:
http://blogs.nologin.es/rickyepoderi/index.php?/archives/87-Copy-n-Paste-in-KVM.html
Solution was to run installer in this ISO (do not have url, sorry, I think Google can find it)
virtio-win-0.1.126.iso
Download latest spice tools from here: https://www.spice-space.org/download/binaries/spice-guest-tools/ and install it.
@pavlov99
pavlov99 / ansible-galaxy-find-role-id.sh
Created March 27, 2017 07:11
Find your role's id in ansible-galaxy
$ ansible-galaxy info YourUser.RoleName | grep -E 'id: [0-9]' | awk {'print $2'}
@xtream1101
xtream1101 / Backup&RestoreRepo.md
Created June 29, 2019 12:38
Backup and restore a git repo using git bundle

Backup/archive a repo

  1. Clone the repo
git clone --mirror https://github.com/vuejs/vue
  1. cd into the cloned repo
  2. Create a bundle file in the parent directory
git bundle create ../vuejs_vue.bundle --all