Skip to content

Instantly share code, notes, and snippets.

View hygull's full-sized avatar
😃
Enjoying work at AIPALETTE & in home. Programming is there as my best friend.

Rishikesh Agrawani hygull

😃
Enjoying work at AIPALETTE & in home. Programming is there as my best friend.
View GitHub Profile
@hygull
hygull / setting-env-var-permanently-in-node.md
Last active November 9, 2018 13:24
Setting environment variable permanently in Node.js
/*	
	- https://stackoverflow.com/questions/20643470/execute-a-command-line-binary-with-node-js
	
	- https://social.technet.microsoft.com/Forums/windows/en-US/a5593733-a7b5-4079-a3ab-a1f9b29532f7/setx-command-error-access-tot-he-registry-path-is-denied?forum=w7itprogeneral
*/

const {spawnSync} = require("child_process");

// setx -m MyDownloads H:\temp\downloads
@hygull
hygull / numbersProcessor.js
Created October 14, 2018 08:09
Filter numbers available in string and add to the respective arrays available in object
/**
- Programmed on: 14 Oct 2018, Sun
- Function description:
- numbersProcessor(object, str) is function which takes 2 parameters
- object is real javascript object like {}, {'name': 'Raghvendra Thakur', 'age: 25'}
- str is string which is either a sequence of comma separated integers/floats
- This function considers that the calling code passes valid inputs so there is no
specific input validation code
- Place integers/floats in the respective arrays pointed by same keys in object
@hygull
hygull / Ajax-data-send.html
Last active September 30, 2018 12:56
Ajax Data Send - jQuery (POST example)
<!DOCTYPE html>
<html lang="en">
<head>
<title>User creation</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
@hygull
hygull / Sublime Text 3 - Serial key for build 3176.md
Last active August 24, 2018 11:19
Sublime Text 3 - Serial key for build 3176

Sublime Text 3 - Serial key for build 3176

Steps »

  1. Copy the below key.
----- BEGIN LICENSE -----
sgbteam
Single User License
@hygull
hygull / Python - bitstruct.md
Last active June 18, 2018 05:30
Python - bitstruct

pip install bitstruct

H:\RishikeshAgrawani\Projects\Sof\BitFields>pip install bitstruct
Collecting bitstruct
  Downloading https://files.pythonhosted.org/packages/f1/20/ce0e9cbfe93614f18b5cd760a092b068abf552d27d9e3bfe50c9c3ad4deb/bitstruct-3.9.0-py2.py3-none-any.whl
Installing collected packages: bitstruct
Successfully installed bitstruct-3.9.0

Code executed on Python interactive terminal

<!DOCTYPE html>
<html>
<head>
<link href="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.2.0/jquery.qtip.min.css" rel="stylesheet" type="text/css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.2.12/cytoscape.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/cytoscape/cytoscape.js-qtip/2.7.0/cytoscape-qtip.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.2.0/jquery.qtip.min.js"></script>
<script src="graph.js"></script>
</head>
# Code
def duplicate_finder(word):
word = word.lower()
i = 1;
for ch, count in Counter(word).items():
# print '(', i, ') Original character: \'', ch, '\'with', count - 1, 'more occurence(s)'
if count == 1:
word = word.replace(ch, '(')
else:
@hygull
hygull / Getting-Usernames-And-Dynamically-Create-Table.html
Created May 20, 2018 09:59
Getting Usernames And Dynamically Create Table - JavaScript
<!DOCTYPE html>
<html lang="en">
<head>
<title>All Users - Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>

Javascript Generated Image Gallery (My suggested solution is on Stackoverflow)

The specified JSON was not in valid form as it is missing two } (curley braces) and one ] (right big bracket). I visited https://jsoneditoronline.org and corrected it.

Note: I have saved the corrected JSON file paws.json at this web page on Github. Please use that one.

The error line is highlighted in the below image (on left). I have added ]}} to fix the issue with JSON.

[![enter image description here][1]][1]

@hygull
hygull / paws.json
Last active May 10, 2018 11:12
Stackoverflow's question "Javascript Generated Image Gallery"(https://stackoverflow.com/questions/50267905/javascript-generated-image-gallery) had wrong JSON data. I fixed it with the help of https://jsoneditoronline.org.
{
"@encoding": "iso-8859-1",
"@version": "1.0",
"petfinder": {
"@xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
"lastOffset": {
"$t": "25"
},
"pets": {
"pet": [