Skip to content

Instantly share code, notes, and snippets.

View sks147's full-sized avatar

Sumit Kumar Singh sks147

View GitHub Profile
@sks147
sks147 / append_filename_to_beginning_of_file.sh
Created May 13, 2021 04:43
append_filename_to_beginning_of_file.sh
counter=1
for f in * ; do
file_name=$(basename $f);
split_file_name=(${file_name//./ });
file_name_without_extension=${split_file_name[0]}
gsed -i "1i # ${counter}. ${file_name_without_extension^^} \
" $file_name
((counter=counter+1))
done;
@sks147
sks147 / cloudwatch-alert-sns-to-slack.js
Created February 2, 2021 10:13
Send Cloudwatch Alerts from SNS to slack
console.log('[Amazon CloudWatch Notification]');
//Taken from https://raw.githubusercontent.com/ashiina/aws-lambda-cloudwatch-slack/master/handler.js
var ALARM_CONFIG = [
{
channel: "#cloudwatch-alerts",
mention: "<@here> ",
color: "#F35A00",
severity: "CRITICAL"
@sks147
sks147 / .yabairc
Created November 23, 2020 16:41
yabairc config
#!/usr/bin/env sh
# global settings
yabai -m config mouse_follows_focus off
yabai -m config focus_follows_mouse off
yabai -m config window_placement second_child
yabai -m config window_topmost on
yabai -m config window_shadow off
yabai -m config window_opacity on
yabai -m config active_window_opacity 1.0
@sks147
sks147 / a.js
Created September 11, 2019 08:58
Node.js Convert JSON to CSV
const fs = require('fs').promises;
const jsonData = require('./generated.json');
const JSONToCSV = require('json2csv').parse;
const fields = ['balance', 'age', 'name', 'gender', 'company', 'email', 'phone'];
const opts = { fields: fields };
async function convert() {
const csv = JSONToCSV(jsonData, opts);
try {
@sks147
sks147 / aiff_to_mp3.sh
Last active December 14, 2019 04:06
Convert aiff to mp3
ffmpeg -i myinput.aif -f mp3 -acodec libmp3lame -ab 320000 -ar 44100 myoutput.mp3
ffmpeg -i myinput.m4a -f mp3 -acodec libmp3lame -ab 320000 -ar 44100 myoutput.mp3
@sks147
sks147 / svm_classification_result.csv
Created May 6, 2019 15:10
Used SVM with the "one vs the rest" strategy for multi-class classification.
Clusters (K) Bag of Words VLAD
20 0.6455 0.9576
40 0.7513 0.9735
60 0.7724 0.9682
80 0.7671 0.9576
100 0.7989 0.9682
120 0.8465 0.9682
@sks147
sks147 / mysql.md
Last active April 29, 2019 07:16
Setup mysql

To install, run:

$ brew update
$ brew install mysql

Usage

To have launchd start MySQL now and restart at login:

@sks147
sks147 / delete.sh
Created April 13, 2019 02:12
Command to delete ".exe" files recursively from current directory
grep -rl ".exe" . | sed 's/./\\&/g' | xargs rm --
# https://unix.stackexchange.com/a/55990/319910
@sks147
sks147 / Speaker_Delay.md
Last active April 7, 2019 01:53
Pavucontrol : Fix Bluetooth Speaker Delay