Skip to content

Instantly share code, notes, and snippets.

View jay3sh's full-sized avatar

Jayesh Salvi jay3sh

View GitHub Profile
### Keybase proof
I hereby claim:
* I am jay3sh on github.
* I am jay3sh (https://keybase.io/jay3sh) on keybase.
* I have a public key ASDisveofvyc0qtIYvkSUPKfTfFhBhMTHkUTUUP9SQKH1Ao
To claim this, I am signing this object:
@jay3sh
jay3sh / CMakeLists.txt
Created May 14, 2017 12:56
CMakeLists.txt for GSL project to make it browsable in Qt Creator
cmake_minimum_required(VERSION 3.0.0)
project(GSL)
set(CMAKE_C_COMPILER "/usr/bin/gcc")
set(CMAKE_VERBOSE_MAKEFILE ON)
file(GLOB_RECURSE SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/*.c)
file(GLOB_RECURSE INC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
@jay3sh
jay3sh / guard-my-mabook-when-i-am-away.sh
Created March 30, 2016 16:46
Guard My Macbook When I'm Away
#!/bin/bash
#
# When you are working on your macbook sitting in cafe and you have to go pee,
# you need some way to guard you machine.
#
# Start this script, remove any earphones, and go do the job.
# The assumption is the thief will close the lid of the laptop before taking it away.
# This script detects the closing of the lid and plays some loud audio that will
# likely distract the thief and/or grab attention of nearby people, making the
@jay3sh
jay3sh / cryptotest.js
Created April 9, 2014 16:23
node.js crypto algorithm comparision
var crypto = require('crypto');
function run(algo) {
var hash = crypto.createHash(algo);
hash.update('operation');
hash.update('1');
hash.update('A34');
hash.update('ABS');
return hash.digest('hex');
@jay3sh
jay3sh / 7.coffee
Created November 24, 2012 07:52
Switch-To-Coffeescript-Code-Snippets-2
# While invoking a function you don't have to put the arguments in parenthesis.
# Instead of writing
console.log(message)
# You can write
console.log message
# Although this is convenient, it can be confusing for nested function calls
foo bar 2,3
# is equivalent to
foo(bar(2,3))
@jay3sh
jay3sh / 1.coffee
Created November 24, 2012 03:27
Switch-To-Coffeescript-Code-Snippets
methodfoo : (arg0) ->
func = => x = @someproperty
func()
@jay3sh
jay3sh / forum_main.cpp
Created September 3, 2012 03:27
OpenCASCADE 6.5.3 Boolean operations hang
/*
* This Program hangs for values of TOTAL >10
* consuming about 90% when run with OCC 6.5.3 on Ubuntu 11.04
*
* Build instructions
*
* g++ -o forum_main.o -c -I$OCC_INSTALL_DIR/inc forum_main.cpp
*
* g++ -o main -Xlinker -rpath -Xlinker $OCC_INSTALL_DIR/lib forum_main.o \
* -L$OCC_INSTALL_DIR/lib -lTKernel -lPTKernel -lTKMath -lTKService -lTKV3d -lTKV2d -lTKBRep -lTKIGES -lTKSTL -lTKSTEP -lTKSTEPAttr -lTKSTEP209 -lTKSTEPBase -lTKShapeSchema -lTKGeomBase -lTKGeomAlgo -lTKG3d -lTKG2d -lTKXSBase -lTKPShape -lTKShHealing -lTKHLR -lTKTopAlgo -lTKMesh -lTKPrim -lTKCDF -lTKBool -lTKBO -lTKFillet -lTKOffset
@jay3sh
jay3sh / gist:3083080
Created July 10, 2012 12:54
Watch script to compile Coffeescript, Jade and Less.css
/*
* Tested on node 0.6, Ubuntu
*/
#!/usr/bin/node
COLOR_GREEN="\033[01;32m"
COLOR_RED="\033[01;31m"
COLOR_YELLOW="\033[01;33m"
COLOR_BLUE="\033[01;34m"
COLOR_NORMAL="\033[00m"
@jay3sh
jay3sh / sewmesh.py
Created December 8, 2011 07:21
Create Shape from raw face/vertex information
import sys
from OCC.gp import gp_Pnt
from OCC.BRep import BRep_Builder
from OCC.BRepBuilderAPI import BRepBuilderAPI_Sewing
from OCC.BRepBuilderAPI import BRepBuilderAPI_MakePolygon
from OCC.BRepBuilderAPI import BRepBuilderAPI_MakeFace
from OCC.BRepBuilderAPI import BRepBuilderAPI_MakeVertex
from OCC.TopoDS import TopoDS_Compound
from OCC import StlAPI
@jay3sh
jay3sh / text-example.py
Created November 29, 2011 14:57
Generate solids in shape of text
#!/usr/bin/python
import sys
import math
sys.path.append('./src')
from cadmium import *
stlfname = sys.argv[1]