Skip to content

Instantly share code, notes, and snippets.

@troyscott
troyscott / check_errorlevels.bat
Created April 10, 2013 20:32
Check error level after the SSIS package completes. If the error level does not 0 stop running the batch file.
@ECHO OFF
SET DTEXEC_PATH="C:\Program Files\Microsoft SQL Server\110\DTS\Binn\dtexec.exe"
%DTEXEC_PATH% /FILE batch_success.dtsx
IF %ERRORLEVEL% NEQ 0 GOTO STOP_JOB
%DTEXEC_PATH% /FILE batch_fail.dtsx
IF %ERRORLEVEL% NEQ 0 GOTO STOP_JOB
%DTEXEC_PATH% /FILE batch_success.dtsx
IF %ERRORLEVEL% NEQ 0 GOTO STOP_JOB
@proudlygeek
proudlygeek / commands-channel.go
Last active March 31, 2024 03:31
Golang Commands in Goroutines
package main
import (
"fmt"
"log"
"os/exec"
"runtime"
)
type Worker struct {
@eclecticlogic
eclecticlogic / CubicBezierCurve.java
Last active May 11, 2020 00:19
Fits a Cubic Bezier curve and allows you to treat it as y = f(x)
import java.util.HashMap;
import java.util.Map;
/**
* @author kabram.
*
*/
public class CubicBezierCurve {
#ifndef UTIL_STRING_UTILS_HPP
#define UTIL_STRING_UTILS_HPP
// trim from start
static inline std::string &string_ltrim(std::string &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
return s;
}
// trim from end
package com.example.android.opengl;
import android.graphics.Point;
public class Bezier {
private static final float AP = 0.5f;
private Point[] bPoints;
public Bezier(Point[] points) {
int n = points.length;
if (n < 3) {
@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
@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"
@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
@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);
@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>