Skip to content

Instantly share code, notes, and snippets.

View genericpenguin's full-sized avatar

genericpenguin

View GitHub Profile
@genericpenguin
genericpenguin / Jenkinsfile
Last active December 9, 2020 00:22 — forked from jasonk/Jenkinsfile
Docker credential helper for authenticating from environment variables
pipeline {
environment {
DOCKER_REGISTRY = 'https://my-docker-registry.example.com'
DOCKER_CREDS = credentials( 'my-docker-credentials' )
}
}
@genericpenguin
genericpenguin / connection_manager.cr
Created April 26, 2018 22:33
TCPSocket closing connection on spawn
require "socket"
class ConnectionManager
@client : TCPSocket
@channel_send : Channel(String)
@channel_receive : Channel(String)
def initialize(server, port)
@client = TCPSocket.new(server, port)
@channel_send = Channel(String).new
@channel_receive = Channel(String).new
html, html * {
color: rgb(183, 183, 183) !important;
background-color:#222;
}
*{border-color:#a4afaf !important;}
input[type="button"]:hover, input[type="submit"]:not(.color):hover,
input[type="reset"]:hover, button:hover, select:hover {
color: #e9e9e9 !important;
background-color: #303030 !important;
@genericpenguin
genericpenguin / gist:262ebb941d1db2ad31e3b89ceba5969d
Created February 27, 2018 21:08
Backtrace of Crystal compiler error when trying @grid = Array.new(@size_x) { |i| [0] }
Svens-MacBook-Pro-2:src sven$ crystal world.cr
cast from Nil to Crystal::GenericInstanceType+ failed, at /private/tmp/crystal-lang-20180127-57131-6tccbo/crystal-0.24.1/src/compiler/crystal/types.cr:1428:20:1428
Crystal::TypeParameter#solve<Crystal::NonGenericClassType>:Crystal::ASTNode+
Crystal::GenericInstanceType+@Crystal::GenericInstanceType#replace_type_parameters<Crystal::NonGenericClassType>:Crystal::Type+
Crystal::TypeDeclarationProcessor#process_owner_guessed_instance_var_declaration<Crystal::Type+, String, Crystal::TypeDeclarationProcessor::InstanceVarTypeInfo>:(Crystal::MetaTypeVar | Crystal::TypeDeclarationProcessor::Error | Nil)
Crystal::TypeDeclarationProcessor#process_instance_vars_declarations:Nil
Crystal::Program#top_level_semantic<Crystal::ASTNode+>:Tuple(Crystal::ASTNode+, Crystal::TypeDeclarationProcessor)
Crystal::Program#semantic<Crystal::ASTNode+, Bool>:Crystal::ASTNode+
Crystal::Compiler#compile<Array(Crystal::Compiler::Source), String>:Crystal::Compiler::Result
Crystal::Command#run_co
@genericpenguin
genericpenguin / synth.cpp
Created January 17, 2016 20:55
Arduino Synth
/* Arduino Synth from
https://janostman.wordpress.com/2016/01/15/how-to-build-your-very-own-string-synth/
*/
#include <avr/interrupt.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
@genericpenguin
genericpenguin / requestInterceptor.groovy
Created January 10, 2016 22:07
Error trying to add request interceptor to HTTPClient object in HTTPBuilder from Groovy postbuild plugin within an enclosing class
jira = new HTTPBuilder( url )
jira.client.addRequestInterceptor( new HttpRequestInterceptor() {
void process( HttpRequest httpRequest, HttpContext httpContext ) {
httpRequest.addHeader( 'Authorization', 'Basic ' +
"$username:$password".bytes.encodeBase64().toString() )
}
})
/* Error caused by code above
No signature of method: org.apache.http.impl.client.DefaultHttpClient.addRequestInterceptor()
is applicable for argument types:
@genericpenguin
genericpenguin / addGroovyPostBuild.groovy
Created January 10, 2016 21:48
Jenkins Groovy script to add Groovy postbuild script to many projects
import hudson.model.FreeStyleProject
import hudson.model.Hudson
import hudson.tasks.Publisher
import org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder
import org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript;
import org.jenkinsci.plugins.scriptsecurity.scripts.ClasspathEntry;
// Exclusion list for job names. Job names listed here will NOT have the groovy postbuild entry added.
def exclusion_list = ["some_job_that_doesnt_need_groovy_postbuild"]