Instantly share code, notes, and snippets.

View gist:be7ce4f62e21a898fe4a9a334dc67f5e
So, looking into the Jenkins CLI docs, it mentions the preferred method of auth is to set up an SSH Public Key in your Jenkins user account, then referencing that with the CLI like:
java -jar /opt/jenkins-cli.jar -s "http://localhost:8080" -i path/to/key.rsa who-am-i
Digging down deeper into the CLI jarfile options, I found that the username/password combo is still usable with the -auth option:
java -jar /opt/jenkins-cli.jar -s "http://localhost:8080" -auth username:password who-am-i
The docs do state you should use your Jenkins user token if possible, but it's much harder to automate the user setup and token retrieval, than to use a username and password setup by automated build scripts.
View gist:2a929afa21f94d0e08d8c158149f4bf5
Sometimes, it helps to route just some traffic over a VPN. It doesn’t make sense to add a lot of latency to your vpn if you don’t need it. So here’s the magic. This only works if you have your own OpenVPN server. (See my post on using Amazon’s free tier to make it happen).
Simply comment out the redirect-gateway def1 statement in your openvpn server.conf file.
and on the client, just put in the following line:
route 12.12.12.0 255.255.255.0 vpn_gateway
Obviously this routes only the 12.12.12.0 subnet out the vpn connection and everything out your non vpn connection.
View gist:0e2addaa8bd35e7581be9700000f7c80
re = /[(]\d{2}[)]/m
str = '19
20
(24)
'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
View gist:7fc732ae0acf77fb12f95e308af01928
require 'json'
this_one = JSON.method(:parse)
puts this_one.source_location
View gist:9f9bb48d29ca2b435eea3cdbaddd4aa7
{
"color_scheme": "Packages/Color Scheme - Default/Mariana.sublime-color-scheme",
"font_size": 22,
"ignored_packages":
[
"Vintage"
],
"open_files_in_new_window": false,
"tab_size": 4,
"theme": "Soda Light.sublime-theme",
View gist:a74d945ea2a2cffb8cbd2f26c01567aa
For Windows Users:
go to C:\Windows\System32\drivers\etc\hosts
Add this line "0.0.0.0 account.jetbrains.com" (without quotes)
For Linux/Mac users:
Open /etc/hosts file. (go to terminal and type: sudo nano /etc/hosts)
Add this line "0.0.0.0 account.jetbrains.com" (without quotes)
Then paste the activation code in supporting Jetbrains tool from @ashiqulemu comment:
View cfnresponse_example.py
import random
import string
import cfnresponse
def id_generator(size, chars=string.ascii_lowercase + string.digits):
return ''.join(random.choice(chars) for _ in range(size))
def handler(event, context):
if event['RequestType'] == 'Delete':
cfnresponse.send(event, context, cfnresponse.SUCCESS, {})