Skip to content

Instantly share code, notes, and snippets.

View basebandit's full-sized avatar
🏠
Working from home

basebandit

🏠
Working from home
View GitHub Profile
@basebandit
basebandit / nexus-provision.groovy
Created June 16, 2023 18:59 — forked from rgl/nexus-provision.groovy
provision nexus users that can push or deploy to any repository (e.g. NuGet or Maven)
// see https://books.sonatype.com/nexus-book/3.0/reference/scripting.html
// see https://github.com/sonatype/nexus-book-examples/tree/nexus-3.0.x/scripting/nexus-script-example
import groovy.json.JsonOutput
import org.sonatype.nexus.security.user.UserSearchCriteria
import org.sonatype.nexus.security.authc.apikey.ApiKeyStore
import org.sonatype.nexus.security.realm.RealmManager
import org.apache.shiro.subject.SimplePrincipalCollection
import org.sonatype.nexus.scheduling.TaskScheduler
import org.sonatype.nexus.scheduling.schedule.Daily
@basebandit
basebandit / bcrypt-promise.js
Created October 11, 2018 08:03 — forked from dmh2000/bcrypt-promise.js
Using bcrypt with promises to hash a password and then verify it
let bcrypt = require('bcrypt-nodejs');
let password = "hello";
let stored_hash = "";
// first generate a random salt
function genSalt(password) {
return new Promise((resolve,reject) => {
bcrypt.genSalt(10,function(err,salt) {
if (err) {
@basebandit
basebandit / utils.js
Created August 9, 2018 08:34 — forked from dc198689/utils.js
build/utils.js
exports.cssLoaders = function(options) {
...
...
function resolveResouce(fileName) {
// Absolute Path
return path.resolve(__dirname, '../src/assets/scss/' + fileName)
}
function generateSassResourceLoader() {
var loaders = [
@basebandit
basebandit / after_res_hooks.js
Created July 5, 2018 07:40 — forked from pasupulaphani/after_res_hooks.js
Mongoose connection best practices
var db = mongoose.connect('mongodb://localhost:27017/DB');
// In middleware
app.use(function (req, res, next) {
// action after response
var afterResponse = function() {
logger.info({req: req}, "End request");
// any other clean ups
@basebandit
basebandit / howto-standalone-toolchain.md
Created November 29, 2016 07:15 — forked from Tydus/howto-standalone-toolchain.md
How to install Standalone toolchain for Android

HOWTO Cross compiling on Android

5W1H

What is NDK

NDK (Native Develop Toolkit) is a toolchain from Android official, originally for users who writes native C/C++ code as JNI library. It's not designed for compiling standalone programs (./a.out) and not compatible with automake/cmake etc.

What is Standalone Toolchain

"Standalone" refers to two meanings:

  1. The program is standalone (has nothing connect to NDK, and don't need helper scripts to run it)
  2. The toolchain is made for building standalone programs and libs, and which can used by automake etc.

(Optional) Why NDK is hard to use

By default, NDK uses android flavor directory structure when it's finding headers and libs, which is different from GNU flavor, so the compiler cannot find them. For Example:

{% macro render(form) -%}
<fieldset>
{% for field in form %}
{% if field.type in ['CSRFTokenField', 'HiddenField'] %}
{{ field() }}
{% else %}
<div class="clearfix {% if field.errors %}error{% endif %}">
{{ field.label }}
<div class="input">