Skip to content

Instantly share code, notes, and snippets.

View mahaidong's full-sized avatar
🏠
Working from home

ma haidong mahaidong

🏠
Working from home
View GitHub Profile
@mahaidong
mahaidong / interp1.lisp
Created October 31, 2019 11:02 — forked from mnicky/interp1.lisp
simple Scheme interpreter, including macros, by Peter Norvig
;source: http://norvig.com/paip/interp1.lisp
;;; -*- Mode: Lisp; Syntax: Common-Lisp; -*-
;;; Code from Paradigms of Artificial Intelligence Programming
;;; Copyright (c) 1991 Peter Norvig
;;; File interp1.lisp: simple Scheme interpreter, including macro.sgi
(defun interp (x &optional env)
"Interpret (evaluate) the expression x in the environment env."
@LakshyAAAgrawal
LakshyAAAgrawal / pytranslate.md
Last active February 20, 2024 12:36
Pytranslate - Maxima to Python Translator
@vivekjoshy
vivekjoshy / MVCE_main.py
Last active March 4, 2022 15:55
Thread Based PyQt5 Python Console
import sys
import time
from code import InteractiveConsole
from PyQt5 import uic
from PyQt5.QtCore import pyqtSlot, QThread, QObject, pyqtSignal, QTimer
from PyQt5.QtGui import QTextOption, QTextCursor
from PyQt5.QtWidgets import QApplication
__author__ = "daegontaven"
@ocornut
ocornut / imgui_node_graph_test.cpp
Last active April 23, 2024 19:02
Node graph editor basic demo for ImGui
// Creating a node graph editor for Dear ImGui
// Quick sample, not production code!
// This is quick demo I crafted in a few hours in 2015 showcasing how to use Dear ImGui to create custom stuff,
// which ended up feeding a thread full of better experiments.
// See https://github.com/ocornut/imgui/issues/306 for details
// Fast forward to 2023, see e.g. https://github.com/ocornut/imgui/wiki/Useful-Extensions#node-editors
// Changelog
// - v0.05 (2023-03): fixed for renamed api: AddBezierCurve()->AddBezierCubic().
@VonMoustachen
VonMoustachen / gist:b54f0afd134efd426f62
Last active September 17, 2019 08:34
SHM: addWall tool
# -*- coding: utf-8 -*-
# FreeCAD sheet metal workbench: addWall tool.
# (c) 2014 Javier Martínez García
#***************************************************************************
#* (c) Javier Martínez García 2014 *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
@PaulMougel
PaulMougel / client.js
Last active May 1, 2024 12:38
File upload in Node.js to an Express server, using streams
// node: v0.10.21
// request: 2.27.0
var request = require('request');
var fs = require('fs');
var r = request.post("http://server.com:3000/");
// See http://nodejs.org/api/stream.html#stream_new_stream_readable_options
// for more information about the highWaterMark
// Basically, this will make the stream emit smaller chunks of data (ie. more precise upload state)
var upload = fs.createReadStream('f.jpg', { highWaterMark: 500 });
@Shaptic
Shaptic / Triangulate.py
Last active June 14, 2023 23:31
Fokin' triangulation.
"""
Triangluation simulator.
Left mouse button: place a vertex.
Right mouse button: finalize a shape.
T: triangulate shapes.
"""
import math
from random import randint
@tomekc
tomekc / ps-export-layers-to-png.jsx
Created June 7, 2012 22:21
Photoshop script that exports to PNG all layers and groups whose names end with ".png".
#target photoshop
// $.level = 2;
/*
* Script by Tomek Cejner (tomek (at) japko dot info)
* based on work of Damien van Holten:
* http://www.damienvanholten.com/blog/export-groups-to-files-photoshop/
*
* My version adds support of nested layer groups,
* and exports single layers in addition to groups.