Skip to content

Instantly share code, notes, and snippets.

IFS=$'\n'
myUser=`whoami`
echo Local user is $myUser
SYNO_USER=`psql synofoto -t -c "select id from user_info where name='$myUser'"`
echo SYNO_USER is $SYNO_USER
echo Scanning for video files..
for i in `find . -iname \*.mov -type f | grep -v eaDir | grep -v "_3"`; do
#echo i is $i
fname=$(dirname ${i})/@eaDir/$(basename ${i})/SYNOPHOTO_FILM_H.mp4;
@aerobium
aerobium / ReplacingTtextInApachePOIXWPF.java
Created October 3, 2017 11:11
Replacing a text in Apache POI XWPF
iterateThroughParagraphs(doc, fieldsForReport);
iterateThroughFooters(doc, fieldsForReport);
iterateThroughTables(doc, fieldsForReport);
private void iterateThroughParagraphs(XWPFDocument doc, Map<String, String> fieldsForReport) throws NotFoundException {
for (XWPFParagraph paragraph : doc.getParagraphs()) {
iterateThroughRuns(paragraph, fieldsForReport);
}
}
@kevinswiber
kevinswiber / backends.js
Last active February 6, 2024 18:56
Express Gateway Example with Multiple Services
const express = require('express');
const forum = express();
forum
.get('/healthz', (req, res, next) => {
res.send({ name: 'forum', status: 'healthy' });
next();
})
.get('/d/:id', (req, res, next) => {
@jclosure
jclosure / contains_key_or_empty.txt
Created July 3, 2017 05:33
Kibana Painless scripted field checks if field exists or is empty and returns default, otherwise value
if (!doc.containsKey('myfield') || doc['myfield'].empty) { return "unavailable" } else { return doc['myfield'].value }
The following properties are necessary for configuring Spring Zuul Proxy with SSL
Create a self signed certificate
keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass digilabs -validity 360 -keysize 2048
Place the keystore.jks in the resources folder of your application.
server:
ssl:
@gunjanpatel
gunjanpatel / revert-a-commit.md
Last active September 20, 2025 22:27
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

import { Pipe } from 'angular2/core.js';
/**
* Map to Iteratble Pipe
*
* It accepts Objects and [Maps](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)
*
* Example:
*
* <div *ngFor="#keyValuePair of someObject | mapToIterable">
@Foxandxss
Foxandxss / nginx-vhost
Last active June 12, 2020 07:12 — forked from bartvanremortele/nginx-vhost
Nginx vhost configuration for proxying requests to an API running on a different port. Easy to avoid CORS / JSONP
upstream api_node_js {
server 127.0.0.1:8080;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/my-kickass-domain/public_html;
index index.html index.htm;
@Juul
Juul / ssh-copy-id-openwrt
Last active May 18, 2025 22:24
ssh-copy-id but for openwrt / dropbear
#!/bin/sh
if [ "$#" -ne 1 ]; then
echo "Example: ${0} root@192.168.1.1"
exit 1
fi
cat ~/.ssh/id_rsa.pub | ssh ${1} "cat >> /etc/dropbear/authorized_keys && chmod 0600 /etc/dropbear/authorized_keys && chmod 0700 /etc/dropbear"
@figpope
figpope / validator.js
Created April 24, 2015 18:15
1000Hz Validator for Bootstrap w/ support for hidden elements
/* ========================================================================
* Bootstrap (plugin): validator.js v0.8.1
* ========================================================================
* The MIT License (MIT)
*
* Copyright (c) 2015 Cina Saffary.
* Made by @1000hz in the style of Bootstrap 3 era @fat
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal