Skip to content

Instantly share code, notes, and snippets.

Jayesh Salvi jay3sh

View GitHub Profile
View gist:e8e82f276fc6042c3c16e54d059c247a
### 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
CMakeLists.txt for GSL project to make it browsable in Qt Creator
View CMakeLists.txt
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 Mar 30, 2016
Guard My Macbook When I'm Away
View guard-my-mabook-when-i-am-away.sh
#!/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 Apr 9, 2014
node.js crypto algorithm comparision
View cryptotest.js
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 Nov 24, 2012
Switch-To-Coffeescript-Code-Snippets-2
View 7.coffee
# 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 Nov 24, 2012
Switch-To-Coffeescript-Code-Snippets
View 1.coffee
methodfoo : (arg0) ->
func = => x = @someproperty
func()
@jay3sh
jay3sh / forum_main.cpp
Created Sep 3, 2012
OpenCASCADE 6.5.3 Boolean operations hang
View forum_main.cpp
/*
* 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 Jul 10, 2012
Watch script to compile Coffeescript, Jade and Less.css
View gist:3083080
/*
* 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 Dec 8, 2011
Create Shape from raw face/vertex information
View sewmesh.py
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 Nov 29, 2011
Generate solids in shape of text
View text-example.py
#!/usr/bin/python
import sys
import math
sys.path.append('./src')
from cadmium import *
stlfname = sys.argv[1]
You can’t perform that action at this time.