Skip to content

Instantly share code, notes, and snippets.

View palaniraja's full-sized avatar

palaniraja palaniraja

View GitHub Profile
@palaniraja
palaniraja / Default (OSX).sublime-commands
Created October 25, 2024 23:34
sublime shortcut for converting epoch seconds ~/Library/Application Support/Sublime Text/Packages/User/
[
{
"caption": "Epoch Converter",
"command": "epoch_converter"
}
]
@palaniraja
palaniraja / resource-monitor.sh
Last active October 20, 2024 19:27
poor man's resource monitor for raspberrypi home server
#!/bin/bash
# step 1: install these tools
# sudo apt install sysstat
# sudo apt install ifstat
# step 2: setup header for the files in ~/scripts
@palaniraja
palaniraja / CMakeLists.txt
Created July 7, 2024 23:36
wasm file merger
cmake_minimum_required(VERSION 3.12)
project(concat_files)
set(CMAKE_CXX_STANDARD 14)
# set(CMAKE_CXX_COMPILER em++)
add_executable(concat_files main.cpp)
set_target_properties(concat_files PROPERTIES LINK_FLAGS "\
-s WASM=1 \
@palaniraja
palaniraja / CMakeLists.txt
Created July 7, 2024 19:15
wasm file sharing between js and c
cmake_minimum_required(VERSION 3.12)
project(uppercase)
set(CMAKE_CXX_STANDARD 14)
add_executable(uppercase uppercase.cpp)
set_target_properties(uppercase PROPERTIES LINK_FLAGS "-s WASM=1 -s EXPORTED_FUNCTIONS=['_uppercase_file'] -s EXPORTED_RUNTIME_METHODS=['ccall','cwrap','FS'] -s FORCE_FILESYSTEM=1")
@palaniraja
palaniraja / combine.sh
Created July 4, 2024 22:47
combine multiple .fbs to one
#!/bin/bash
# The output file
output_file='combined.fbs'
# Remove the output file if it already exists
if [ -f $output_file ]; then
rm $output_file
fi
@palaniraja
palaniraja / CMakeLists.txt
Created July 4, 2024 21:57
emscripten adventures
cmake_minimum_required(VERSION 3.12)
project(fileProcessor)
set(CMAKE_CXX_STANDARD 11)
add_executable(fileProcessor fileProcessor.cpp)
# set_target_properties(fileProcessor PROPERTIES LINK_FLAGS "-s WASM=1 -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"cwrap\"]'")
# set_target_properties(fileProcessor PROPERTIES LINK_FLAGS "-s WASM=1 -s EXPORTED_RUNTIME_METHODS='[\"cwrap\"]' -s EXPORTED_FUNCTIONS='[\"_malloc\", \"_free\"]'")
set_target_properties(fileProcessor PROPERTIES LINK_FLAGS "-s WASM=1 -s EXPORTED_RUNTIME_METHODS='[\"cwrap\", \"UTF8ToString\"]' -s EXPORTED_FUNCTIONS='[\"_malloc\", \"_free\"]'")
@palaniraja
palaniraja / copilot.js
Last active July 2, 2024 22:35
my attempt at using copilot to scrap my own converstation
var serp = document.querySelector('cib-serp');
console.log("Found # serp: ")
console.log(serp)
var conversation = ""
/* Check if the element has a shadow root */
if (serp && serp.shadowRoot) {
/* Select the "cib-conversation" element within the shadow root */
var conversation = serp.shadowRoot.querySelector('cib-conversation');
@palaniraja
palaniraja / AppContentView.swift
Created May 12, 2024 02:50
Resource file exists in swift package manager vs app
import SwiftUI
import spmlib
struct ContentView: View {
let l = SPMLib()
var body: some View {
VStack {
@palaniraja
palaniraja / history-diff.js
Last active April 12, 2024 22:43
jira desc history diff - quick hack
var hItems = document.querySelectorAll("div[data-testid='issue-history.ui.history-items.generic-history-item.history-item']")
var desc = hItems[1]
if (hItems.length < 1) {
alert("switch to history tab and re-run")
return
}
else {
Array.from(hItems).forEach(function (desc, idx){
if (desc.childNodes.length > 1 ){
prof = desc.childNodes[0]
@palaniraja
palaniraja / ublock - youtube.txt
Last active July 14, 2024 01:55
ublock origin - youtube cosmetics
# youtube cosmetics
www.youtube.com###logo-icon > .yt-icon.style-scope > .yt-spec-icon-shape > div
www.youtube.com###masthead-container:style(opacity:0.25)
www.youtube.com###top-row:style(opacity:0.25)
www.youtube.com##ytd-comments-header-renderer:style(opacity:0.25)
www.youtube.com###secondary:style(opacity:0.25)
www.youtube.com###description:style(opacity:0.25)
www.youtube.com###sections:style(opacity:0.25)