Skip to content

Instantly share code, notes, and snippets.

@katronai
katronai / consume-soap.js
Last active June 7, 2018 12:43
Node.js, AWS Lambda - Consume a SOAP service that requires WS-Addressing and v1.2 specification using node-soap module
var soap = require('soap');
var url = 'http://example.org/MyWebService.svc?wsdl';
var soapOptions = {
forceSoap12Headers: true
};
var soapHeader = {
'wsa:Action': 'http://tempuri.org/MyBinding/MyOperation',
@katronai
katronai / merge-files.sh
Last active October 12, 2017 23:18
Bash script for finding and merging all text files under a directory and its all subdirectories by grouping their parent directory names
outputLocation="/myDrive/myWorkingDirectory" &&
cd "$outputLocation" &&
for dir in $(find -type d)
do
cat "$dir"/*.txt >> "$outputLocation"/${dir##*/}.txt
done
############################################################
# for a folder structure like this #
# myRootDirectory #
@katronai
katronai / aws-cli-commands.sh
Last active March 17, 2017 08:57
AWS CLI commands
#Get configuration
aws configure list
#Get profile credentials
aws configure get myprofile.aws_access_key_id
aws configure get myprofile.aws_secret_access_key
#List all s3 buckets
aws s3 ls --profile myprofile
@katronai
katronai / visual-studio-shortcuts.txt
Last active March 17, 2017 08:57
Visual Studio shortcuts
Show tips
Ctrl + .
Peak view
Alt + F12
Show Solution Explorer
Ctrl + Alt + L
Display quick info
@katronai
katronai / windows-run-commands.txt
Created March 17, 2017 07:47
Windows 10 run commands
Computer management
compmgmt.msc
Control panel
control
Device manager
devmgmt.msc
Disk cleanup
@katronai
katronai / git-commands.sh
Last active March 3, 2020 23:28
Git commands
Initialize a new git repository \
`git init`
Stage files \
`git add .`
Commit messages \
`git commit -m <commit message>`
Clone remote repository \
@katronai
katronai / windows-commands.txt
Created March 17, 2017 08:06
Windows command line commands
Service info
sc queryex servicename
Kill service
taskkill /f /pid mypid
System file checker
sfc /scannow
Available physical memory
@katronai
katronai / tweets-by-date.py
Last active March 3, 2020 23:04
Search tweets by date from Twitter using tweepy
# The following code fetches the most recent 1000 mentions of 'python'.
from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener
import tweepy
import time
ckey ='x'
csecret = 'x'
@katronai
katronai / imputer.py
Last active March 3, 2020 22:57
Impute missing values
imputer = Imputer(missing_values='NaN', strategy='mean', axis=0)
# imputer = Imputer(missing_values='NaN', strategy='median', axis=0)
# imputer = Imputer(missing_values='NaN', strategy='most_frequent', axis=0)
# imputer = Imputer(missing_values=0, strategy='mean', axis=0)
X_train = imputer.fit_transform(X_train)
X_test = imputer.transform(X_test)
@katronai
katronai / bash-commands.md
Last active December 26, 2020 23:43
These are the most useful commands for myself working on Terminal

Bash Commands

  • cd ..
    Change to the parent directory

  • cd -
    Change to the previous directory

  • open .
    Open current folder in Finder