Skip to content

Instantly share code, notes, and snippets.

import jenkins.model.*
instance = Jenkins.getInstance()
globalNodeProperties = instance.getGlobalNodeProperties()
envVarsNodePropertyList = globalNodeProperties.getAll(hudson.slaves.EnvironmentVariablesNodeProperty.class)
newEnvVarsNodeProperty = null
envVars = null
if ( envVarsNodePropertyList == null || envVarsNodePropertyList.size() == 0 ) {
newEnvVarsNodeProperty = new hudson.slaves.EnvironmentVariablesNodeProperty();
@gwsu2008
gwsu2008 / jenkins-approve-script.groory
Created June 3, 2020 06:13
jenkins-approve-script.groory
import java.lang.reflect.*;
import jenkins.model.Jenkins;
import jenkins.model.*;
import org.jenkinsci.plugins.scriptsecurity.scripts.*;
import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.*;
scriptApproval = ScriptApproval.get()
alreadyApproved = new HashSet<>(Arrays.asList(scriptApproval.getApprovedSignatures()))
@Mefistophell
Mefistophell / RUST.MD
Last active July 12, 2024 15:44
How to Compile a Rust Program on Mac for Windows

Question: I want to compile my Rust source code for the Windows platform but I use macOS.

Solution:

  1. Install target mingw-w64: brew install mingw-w64
  2. Add target to rustup: rustup target add x86_64-pc-windows-gnu
  3. Create .cargo/config
  4. Add the instructions below to .cargo/config
[target.x86_64-pc-windows-gnu]
@fwaeytens
fwaeytens / frida-trace.txt
Created December 1, 2019 18:27
Frida-trace
C:\Python27\Scripts>frida-trace.exe -i "CreateFile*" notepad.exe
Instrumenting functions...
CreateFileMappingFromApp: Loaded handler at "C:\\Python27\\Scripts\\__handlers__\\KERNELBASE.dll\\CreateFileMappingFromApp.js"
CreateFile2: Loaded handler at "C:\\Python27\\Scripts\\__handlers__\\KERNELBASE.dll\\CreateFile2.js"
CreateFileA: Loaded handler at "C:\\Python27\\Scripts\\__handlers__\\KERNELBASE.dll\\CreateFileA.js"
CreateFileMapping2: Loaded handler at "C:\\Python27\\Scripts\\__handlers__\\KERNELBASE.dll\\CreateFileMapping2.js"
CreateFileW: Loaded handler at "C:\\Python27\\Scripts\\__handlers__\\KERNELBASE.dll\\CreateFileW.js"
CreateFileMappingW: Loaded handler at "C:\\Python27\\Scripts\\__handlers__\\KERNELBASE.dll\\CreateFileMappingW.js"
CreateFileMappingNumaW: Loaded handler at "C:\\Python27\\Scripts\\__handlers__\\KERNELBASE.dll\\CreateFileMappingNumaW.js"
CreateFileMoniker: Loaded handler at "C:\\Python27\\Scripts\\__handlers__\\ole32.dll\\CreateFileMoniker.js"
@lvxianchao
lvxianchao / npm.taobao.sh
Last active July 22, 2024 00:41
设置 npm 和 yarn 的镜像源为淘宝镜像源
# ==========================================================
# NPM
# ==========================================================
npm set registry https://registry.npmmirror.com # 注册模块镜像
npm set disturl https://npmmirror.com/mirrors/node # node-gyp 编译依赖的 node 源码镜像
## 以下选择添加
npm set sass_binary_site https://registry.npmmirror.com/mirrors/node-sass # node-sass 二进制包镜像
npm set electron_mirror https://registry.npmmirror.com/mirrors/electron/ # electron 二进制包镜像
@daramkun
daramkun / memcpy_perf_measure.cpp
Created July 3, 2019 15:17
Memory Copy Performance Measure (memcpy, ID3D11DeviceContext::CopyResource)
#include <Windows.h>
#include <d3d11.h>
#include <atlbase.h>
#pragma comment (lib, "d3d11.lib")
#include <iostream>
#include <thread>
#include <chrono>
#include <memory>
#include <vector>
@graphicbeacon
graphicbeacon / console.dart
Last active October 27, 2023 21:16
Final snippets for "How to use JavaScript libraries in your Dart applications" article
// web/console.dart
@JS('console')
library console;
import 'package:js/js.dart';
external void log(dynamic str);
@nkaretnikov
nkaretnikov / break.py
Created August 19, 2017 11:00
IDAPython breakpoint hook
from idc import *
from idaapi import *
from idautils import *
counter = 0
lst = []
addr = 0x01073E62
# See idapython/src/examples/debughook.py
@rms1000watt
rms1000watt / exec-command-stdout-pipe.go
Last active October 22, 2022 12:33
Execute Command with stdout Pipe in Golang
package main
import (
"bufio"
"fmt"
"os/exec"
"errors"
"strings"
log "github.com/sirupsen/logrus"
@mosquito
mosquito / README.md
Last active July 18, 2024 19:07
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/docker-compose@.service. SystemD calling binaries using an absolute path. In my case is prefixed by /usr/local/bin, you should use paths specific for your environment.

[Unit]
Description=%i service with docker compose
PartOf=docker.service
After=docker.service