Skip to content

Instantly share code, notes, and snippets.

@markruler
markruler / AbstractStringBuilder.java
Last active September 29, 2019 19:36
StringBuilder vs. StringBuffer
public AbstractStringBuilder append(String str) {
if (str == null)
return appendNull();
int len = str.length();
ensureCapacityInternal(count + len);
str.getChars(0, len, value, count);
count += len;
return this;
}
@markruler
markruler / BufferedReader.java
Created September 29, 2019 19:39
버퍼 필터 스트림 예제
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); // 선언
String s = bf.readLine(); // String
int i = Integer.parseInt(bf.readLine()); // int
@markruler
markruler / 1_kubernetes_on_macOS.md
Created April 20, 2020 00:26 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

@markruler
markruler / kubectl.md
Created April 21, 2020 00:14 — forked from so0k/kubectl.md
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
@markruler
markruler / Jenkinsfile.groovy
Created May 13, 2020 06:47 — forked from Faheetah/Jenkinsfile.groovy
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"
@markruler
markruler / _service.md
Created June 12, 2020 07:55 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
#!/bin/bash
#
# tomcat This shell script takes care of starting and stopping Tomcat
#
# chkconfig: - 80 20
#
### BEGIN INIT INFO
# Provides: tomcat
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
@markruler
markruler / settings.json
Last active October 20, 2020 03:29
go env in vscode
{
"workbench.startupEditor": "newUntitledFile",
"workbench.iconTheme": "material-icon-theme",
"workbench.editor.enablePreview": false,
"workbench.colorCustomizations":{
"minimap.background": "#00000035",
},
"workbench.tree.indent": 2,
"workbench.editor.showTabs": true,
"window.zoomLevel": 0,
@markruler
markruler / launch.json
Created October 15, 2020 06:25
debugging go code with vscode
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
// https://www.digitalocean.com/community/tutorials/debugging-go-code-with-visual-studio-code
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
@markruler
markruler / launch.json
Created October 29, 2020 00:37
VS Code spring-boot dashboard (microsoft) extenstion
// spring-boot dashboard (microsoft) extenstion
{
"configurations": [
{
"type": "java",
"name": "PetClinicApplication<spring-petclinic>-Spring Boot Dashboard Ext",
"request": "launch",
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"stopOnEntry": false,