Taken from here.
1) List all your processes with
SHOW FULL PROCESSLIST
2) Look at the "State" column, it will mention a lock if existent
3) Kill the process you want by running
KILL [process_id_taken_from_process_list]
Keeping track of interesting places I put my feet on in the software development world.
Search This Blog
Wednesday, February 13, 2019
Sunday, February 10, 2019
Javascript Array Distinct functionality
https://codeburst.io/javascript-array-distinct-5edc93501dc4
Tuesday, February 5, 2019
Translating Set Operations into SQL Joins
Thanks to a colleague from work for sharing this.
The last one is was not familiar to me.
Good to know.
The last one is was not familiar to me.
Good to know.
Thursday, December 20, 2018
Javascript Obfuscation via Jenkins using Node Js and the open source Javascript Obfuscator
A javascript snippet with which I obfuscate javascript files during our building process, via Jenkins (via Node js commands), using the open source Javascript Obfuscator (written in javascript).
var walkSync = function(dir, filelist, dirIgnores, fileIgnores) {
var fs = fs || require('fs');
//if dir is to be ignored, return doing nothing
for (var i = 0; i < dirIgnores.length; i++) {
if (dir.toLowerCase().endsWith("/" + dirIgnores[i].toLowerCase())) {
return;
}
}
files = fs.readdirSync(dir);
filelist = filelist || [];
//lists file starting names to not obfuscate
dirIgnores = dirIgnores || [];
fileIgnores = fileIgnores || [];
files.forEach(function(file) {
var fullPath = dir + '/' + file;
if (fs.statSync(fullPath).isDirectory()) {
filelist = walkSync(fullPath, filelist, dirIgnores, fileIgnores);
} else {
var skip = false;
for (var i = 0; i < fileIgnores.length; i++) {
if (file.toLowerCase().startsWith(fileIgnores[i].toLowerCase())) {
skip = true;
break;
}
}
if (file.endsWith('js') && !skip) {
filelist.push(fullPath);
}
}
});
return filelist;
};
var JavaScriptObfuscator = require('javascript-obfuscator');
// folder will be assigned in jenkins via windows batch string replacement
const folder = '#|#';
const fs = require('fs');
//we obfuscate only our javascript code, all third party libraries (located under folder js) are ignored
var files = walkSync(folder, null, ["js"], null /*["jquery", "leaflet", "dx", "knockout", "jstree"]*/ );
//console.log(files);
var errors = [];
for (var i = 0; i < files.length; i++) {
var file = files[i];
var jsFileContents = fs.readFileSync(file, 'utf8');
console.clear();
console.log('File being obfuscated: ' + file + '...');
try {
//obfuscate
var obfuscationResult = JavaScriptObfuscator.obfuscate(
jsFileContents,
/*************************************************************************/
/* Javascript-obfuscator preset: Medium obsfuscation, optimal performace */
/*************************************************************************/
{
compact: true,
controlFlowFlattening: true,
controlFlowFlatteningThreshold: 0.75,
deadCodeInjection: true,
deadCodeInjectionThreshold: 0.4,
debugProtection: false,
debugProtectionInterval: false,
disableConsoleOutput: true,
identifierNamesGenerator: 'hexadecimal',
log: false,
renameGlobals: false,
rotateStringArray: true,
selfDefending: true,
stringArray: true,
stringArrayEncoding: 'base64',
stringArrayThreshold: 0.75,
transformObjectKeys: true,
unicodeEscapeSequence: false
}
);
//obfuscated content
var obfuscatedJs = obfuscationResult.getObfuscatedCode();
//fs.writeFileSync(file.replace('.js', '_o.js'), obfuscatedJs, {encoding: 'utf8'});
fs.writeFileSync(file, obfuscatedJs, {
encoding: 'utf8'
});
} catch (e) {
errors.push('Error obfuscating ' + file + ': ' + e);
//console.log('Error obfuscating ' + file + ': ' + e);
}
}
console.log(files.length + ' files obfuscated. Errors: ' + errors.length);
if (errors.length > 0)
for (var i = 0; i < errors.length; i++)
console.log(errors[i]);
var walkSync = function(dir, filelist, dirIgnores, fileIgnores) {
var fs = fs || require('fs');
//if dir is to be ignored, return doing nothing
for (var i = 0; i < dirIgnores.length; i++) {
if (dir.toLowerCase().endsWith("/" + dirIgnores[i].toLowerCase())) {
return;
}
}
files = fs.readdirSync(dir);
filelist = filelist || [];
//lists file starting names to not obfuscate
dirIgnores = dirIgnores || [];
fileIgnores = fileIgnores || [];
files.forEach(function(file) {
var fullPath = dir + '/' + file;
if (fs.statSync(fullPath).isDirectory()) {
filelist = walkSync(fullPath, filelist, dirIgnores, fileIgnores);
} else {
var skip = false;
for (var i = 0; i < fileIgnores.length; i++) {
if (file.toLowerCase().startsWith(fileIgnores[i].toLowerCase())) {
skip = true;
break;
}
}
if (file.endsWith('js') && !skip) {
filelist.push(fullPath);
}
}
});
return filelist;
};
var JavaScriptObfuscator = require('javascript-obfuscator');
// folder will be assigned in jenkins via windows batch string replacement
const folder = '#|#';
const fs = require('fs');
//we obfuscate only our javascript code, all third party libraries (located under folder js) are ignored
var files = walkSync(folder, null, ["js"], null /*["jquery", "leaflet", "dx", "knockout", "jstree"]*/ );
//console.log(files);
var errors = [];
for (var i = 0; i < files.length; i++) {
var file = files[i];
var jsFileContents = fs.readFileSync(file, 'utf8');
console.clear();
console.log('File being obfuscated: ' + file + '...');
try {
//obfuscate
var obfuscationResult = JavaScriptObfuscator.obfuscate(
jsFileContents,
/*************************************************************************/
/* Javascript-obfuscator preset: Medium obsfuscation, optimal performace */
/*************************************************************************/
{
compact: true,
controlFlowFlattening: true,
controlFlowFlatteningThreshold: 0.75,
deadCodeInjection: true,
deadCodeInjectionThreshold: 0.4,
debugProtection: false,
debugProtectionInterval: false,
disableConsoleOutput: true,
identifierNamesGenerator: 'hexadecimal',
log: false,
renameGlobals: false,
rotateStringArray: true,
selfDefending: true,
stringArray: true,
stringArrayEncoding: 'base64',
stringArrayThreshold: 0.75,
transformObjectKeys: true,
unicodeEscapeSequence: false
}
);
//obfuscated content
var obfuscatedJs = obfuscationResult.getObfuscatedCode();
//fs.writeFileSync(file.replace('.js', '_o.js'), obfuscatedJs, {encoding: 'utf8'});
fs.writeFileSync(file, obfuscatedJs, {
encoding: 'utf8'
});
} catch (e) {
errors.push('Error obfuscating ' + file + ': ' + e);
//console.log('Error obfuscating ' + file + ': ' + e);
}
}
console.log(files.length + ' files obfuscated. Errors: ' + errors.length);
if (errors.length > 0)
for (var i = 0; i < errors.length; i++)
console.log(errors[i]);
Wednesday, November 21, 2018
I take full responsability
Yes, I am the author of the post below.
Yes, I could not stand not deleting it.
Yes, my conscience obliged me to take record of it.
Yes, I could not stand not deleting it.
Yes, my conscience obliged me to take record of it.
Wednesday, October 31, 2018
How to create Application Configuration files in .NET apps
I was getting mad while debugging my app - I could not find where a specific app.config appSetting key's value was coming from. I checked the machine config file to no avail.
I then simply followed exactly MSDN instructions regarding app.config file creation, and now the app setting key value is correct. Seems this is the way correct way to ensure you know exactly what your deployed config file will look like.
Don't forget to set the file's Build Action (Properties window) to Content. If you leave it as None, it will not be deployed.
I then simply followed exactly MSDN instructions regarding app.config file creation, and now the app setting key value is correct. Seems this is the way correct way to ensure you know exactly what your deployed config file will look like.
Don't forget to set the file's Build Action (Properties window) to Content. If you leave it as None, it will not be deployed.
Monday, October 29, 2018
Useful debugging tips for Visual Studio
https://blogs.msdn.microsoft.com/visualstudio/2017/09/18/7-more-lesser-known-debugging-tactics-for-visual-studio/
Subscribe to:
Posts (Atom)
