Skip to content

Instantly share code, notes, and snippets.

@rako233
rako233 / rmsub.txt
Created November 15, 2019 23:04
Removing a git submodule
git submodule deinit <path_to_submodule>
git rm <path_to_submodule>
git commit-m "Removed submodule "
rm -rf .git/modules/<path_to_submodule>
bl_info = {
"name": "FreeCAD Importer",
"category": "Import-Export",
"author": "Yorik van Havre",
"version": (4, 0, 0),
"blender": (2, 80, 0),
"location": "File > Import > FreeCAD",
"description": "Imports a .FCStd file from FreeCAD",
"warning": "You need a version of FreeCAD compiled with the same Python version as Blender. Only Part- and Mesh-based objects are supported at the moment",
}
@rako233
rako233 / spectre.c
Created January 5, 2018 04:16 — forked from ErikAugust/spectre.c
Spectre example code
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif
session =cfscrape.Session()
cookie, agent = cfscrape.get_tokens('https://bittrex.com')
page = session.get('https://bittrex.com',headers={'User-Agent': agent}, cookies=cookie)
print(page.content)
#!c:\conda\python.exe
# This is a small script for backing up directories on windows. Just drop a directory in the explorer
# on this script and you get a file with the directory name which includes a time stamp.
#
# Requirements:
#
# 1) 7z must be installed with the installer
# 2) A registration of python. This is default for CPython
#
# Usage: Drag and Drop a file or directory on this script
@rako233
rako233 / residual_network.py
Created November 3, 2017 21:26 — forked from mjdietzx/residual_network.py
Clean and simple Keras implementation of residual networks (ResNeXt and ResNet) accompanying accompanying Deep Residual Learning: https://blog.waya.ai/deep-residual-learning-9610bb62c355.
"""
Clean and simple Keras implementation of network architectures described in:
- (ResNet-50) [Deep Residual Learning for Image Recognition](https://arxiv.org/pdf/1512.03385.pdf).
- (ResNeXt-50 32x4d) [Aggregated Residual Transformations for Deep Neural Networks](https://arxiv.org/pdf/1611.05431.pdf).
Python 3.
"""
from keras import layers
from keras import models
@rako233
rako233 / one_hot_lambda_layer_keras.py
Created October 22, 2017 14:32 — forked from bzamecnik/one_hot_lambda_layer_keras.py
One-hot encoding in a Keras Lambda layer
"""
When traing ML models on text we usually need to represent words/character in one-hot encoding.
This can be done in preprocessing, however it may make the dataset file bigger. Also when we'd
like to use an Embedding layer, it accepts the original integer indexes instead of one-hot codes.
Can be move the one-hot encoding from pre-preprocessing directly into the model?
If so we could choose from two options: use one-hot inputs or perform embedding.
A way how to do this was suggested in Keras issue [#3680](https://github.com/fchollet/keras/issues/3680).
""" Change the .py file extension to point to a Python installation."""
import _winreg as reg
import sys
pydir = sys.argv[1]
todo = [
('Applications\python.exe\shell\open\command',
'"PYDIR\\python.exe" "%1" %*'),
('Applications\pythonw.exe\shell\open\command',
@rako233
rako233 / nodetest.py
Created July 10, 2017 19:06 — forked from OEP/nodetest.py
Basic script for Blender Python nodes
import bpy
from bpy.props import IntProperty, FloatProperty, PointerProperty
import nodeitems_utils
from nodeitems_utils import NodeItem, NodeCategory
bl_info = {
"name": "Custom nodes",
"category": "Node",
}
@rako233
rako233 / gist:73ecab3302c3400fc49a20f7516db45f
Last active May 4, 2016 05:33
LDAP Test Of An ActiveDirectory Server With Python
import ldap
import ldif
import sys
def auth(address, username, password):
conn = ldap.initialize('ldap://' + address)
conn.protocol_version = 3
conn.set_option(ldap.OPT_REFERRALS, 0)
try: