Skip to content

Instantly share code, notes, and snippets.

View selimb's full-sized avatar

Selim Belhaouane selimb

View GitHub Profile
@selimb
selimb / gist:affea4b2f2198c171941
Created September 28, 2014 20:24
Problem Set 3 MECH 430
{
"metadata": {
"name": "",
"signature": "sha256:c7b95a8879669ca52a404e446df969830dd8b4ff13fdca2826dbffb744c886ae"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"metadata": {
"name": "",
"signature": "sha256:e3e468554625cb5edf2fe4c5524bbb9d7d3a990559abc5074b07821cbfac487b"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"metadata": {
"name": "",
"signature": "sha256:0ce06ac17869ce94b9abf2f0f55037a6b134311c017964e006d989bb2664a3c3"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@selimb
selimb / ipython_notebook
Last active August 29, 2015 14:17
MECH544 Lab4 -- Pretty ass plots
{
"metadata": {
"name": "",
"signature": "sha256:c34996a1ca2e1b0e7373db4ee21a08e4854fd46d7e9e02beb3210cc176ea8573"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
public void DoIt()
{
NXOpen.CAE.Iteration iteration;
NXOpen.CAE.BaseResultType[] resultTypes;
NXOpen.CAE.BaseResultType velocity, shStress, turbEnergy, turbDiss;
// NXOpen.CAE.Result.Quantity qtt;
iteration = (Iteration)this.solutionResult.GetLoadcases()[0].GetIterations()[0];
resultTypes = iteration.GetResultTypes();
foreach (NXOpen.CAE.BaseResultType resultType in resultTypes)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import os.path
import re
import sys
FILES = ['Date.cpp']
function_dicts = {}
def pluck_classname(filepath):
filename = os.path.basename(filepath)
classname = filename.split('.')[0]
@selimb
selimb / README.md
Created November 8, 2016 01:08
Fixing shift modified with Razer Naga for World of Warcraft

NumLock is bound to backslash: \

@selimb
selimb / mkpass.js
Last active November 27, 2016 19:22
Generate password from SHA1 recipe
SHA1=function(l){function p(b,a){return b<<a|b>>>32-a}l+="€";for(var n=Math,c=[1518500249,1859775393,2400959708,3395469782,1732584193,4023233417,2562383102,271733878,3285377520,4294967295],s=n.ceil(l.length/4)+2,q=n.ceil(s/16),g=[],a=0,h=[],j,d,e,f,m,i,b,k;a<q;a++){g[a]=[];for(k=0;k<16;k++){function o(b,c){return l.charCodeAt(a*64+k*4+b)<<c}g[a][k]=o(0,24)|o(1,16)|o(2,8)|o(3,0)}}i=l.length*8-8;a=q-1;g[a][14]=i/(c[9]+1);g[a][14]=n.floor(g[a][14]);g[a][15]=i&c[9];for(a=0;a<q;a++){for(b=0;b<16;b++)h[b]=g[a][b];for(b=16;b<80;b++)h[b]=p(h[b-3]^h[b-8]^h[b-14]^h[b-16],1);j=c[4];d=c[5];e=c[6];f=c[7];m=c[8];for(b=0;b<80;b++){var r=n.floor(b/20),t=p(j,5)+(r<1?d&e^~d&f:r==2?d&e^d&f^e&f:d^e^f)+m+c[r]+h[b]&c[9];m=f;f=e;e=p(d,30);d=j;j=t}c[4]+=j;c[5]+=d;c[6]+=e;c[7]+=f;c[8]+=m}i="";for(z=4;z<9;z++)for(a=7;a>=0;a--)i+=((c[z]&c[9])>>>a*4&15).toString(16);return i};
var len = 10;
var pre = '';
var post = '';
var text = window.prompt('Enter master');
window.prompt('Copy dat shit', pre + SHA1(text).slice(0, len) + post);
@selimb
selimb / error
Created March 16, 2017 21:27
tox error
$ tox -e py27 -- tests/test_z_cmdline.py::test_alwayscopy
GLOB sdist-make: /Users/selimb/Projects/tox/setup.py
py27 create: /Users/selimb/Projects/tox/.tox/py27
py27 installdeps: pytest>=2.3.5, pytest-timeout
py27 inst: /Users/selimb/Projects/tox/.tox/dist/tox-2.6.1.dev1.zip
py27 installed: appdirs==1.4.3,packaging==16.8,pluggy==0.4.0,py==1.4.32,pyparsing==2.2.0,pytest==3.0.7,pytest-timeout==1.2.0,six==1.10.0,tox==2.6.1.dev1,virtualenv==15.1.0
py27 runtests: PYTHONHASHSEED='113965478'
py27 runtests: commands[0] | py.test --timeout=180 tests/test_z_cmdline.py::test_alwayscopy
=============================================================================== test session starts ===============================================================================
platform darwin -- Python 2.7.10, pytest-3.0.7, py-1.4.32, pluggy-0.4.0