Skip to content

Instantly share code, notes, and snippets.

@PurpleBooth
PurpleBooth / README-Template.md
Last active April 18, 2024 00:56
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@esynr3z
esynr3z / run_tb.do
Last active April 18, 2024 00:54
Tcl script to run Modelsim simulation. Use "vsim -do run_tb.do" to start.
# Simply change the project settings in this section
# for each new project. There should be no need to
# modify the rest of the script.
set tb_name tb_top
set library_file_list [list \
work [list \
../../src/rtl/top.v \
../../src/tb/$tb_name.v] \
@n2o
n2o / nasm_m1.md
Last active April 18, 2024 00:53
Compiling x86_64 assembly program on M1 Mac

If you have an M1 Mac and want to compile and execute x86_64 assembly code, make sure you install Rosetta 2 and nasm (brew install nasm).

Than, take a 64 Bit assembly program, e.g. from this tutorial page (https://cs.lmu.edu/~ray/notes/nasmtutorial/) in Section "Your First Program" for macOS, save it to a file called hello.asm.

Compile, link and execute the program:

nasm -f macho64 hello.asm
ld hello.o -o hello -macosx_version_min 11.0 -L /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lSystem

./hello

@SlyCodePanda
SlyCodePanda / rayCasting.py
Created January 15, 2020 05:27
Ray casting script in Maya using Python.
import maya.OpenMaya as om
import maya.cmds as cmds
def RayIntersect(mesh, point, direction):
# Clear selection.
cmds.select(cl=True)
# Select mesh.
om.MGlobal.selectByName(mesh)
@hopsoft
hopsoft / 00_do_stuff_job.rb
Last active April 18, 2024 00:50
ActiveJob as Service Worker
# ActiveJob natively captures constructor arguments in an `@arguments` instance variable
# which is also exposed as an `arguments` property on each job instance.
#
# Calls to `perform_now` and `perform_later` both forward arguments to the constructor.
#
# For example, all of these invocation styles work.
#
# result = DoStuffJob.new("foobar").perform # sync
# result = DoStuffJob.new.perform("foobar") # sync
# result = DoStuffJob.perform_now("foobar") # sync
@orellabac
orellabac / terminal.html
Last active April 18, 2024 00:49
// Very simple terminal created using xterm.js. You can just paste this code on jsbin
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/xterm/2.6.0/xterm.css" />
<script src="https://cdn.jsdelivr.net/xterm/2.6.0/xterm.js"></script>
<script
src="https://code.jquery.com/jquery-1.12.4.min.js"
integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ="
crossorigin="anonymous"></script>
</head>
@juque
juque / MySQL-Chile:regiones-provincias-comunas
Created July 6, 2010 19:32
Chile: Regiones, Provincias, Comunas
/* Estructura y Datos de las Regiones, Provincias */
/* y Comunas de Chile. */
/* */
/* Fecha: Julio 2010 */
/* Autor: Juan Pablo Aqueveque - juque.cl */
--
-- Comunas
--
DROP TABLE IF EXISTS `comunas`;
@Pickman-Model
Pickman-Model / Mysql 版中国省市区数据表.sql
Created July 27, 2016 13:39
Mysql 版中国省市区数据表,单表结构,数据完备和错误需要自己验证
DROP TABLE IF EXISTS `db_yhm_city`;
CREATE TABLE `db_yhm_city` (
`class_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`class_parent_id` smallint(5) unsigned NOT NULL DEFAULT '0',
`class_name` varchar(120) NOT NULL DEFAULT '',
`class_type` tinyint(1) NOT NULL DEFAULT '2',
PRIMARY KEY (`class_id`),
KEY `class_parent_id` (`class_parent_id`),
KEY `class_type` (`class_type`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
@mokztk
mokztk / WSL2_R410_provision.sh
Last active April 18, 2024 00:47
WSL2 の Ubuntu 20.04 LTS に R4.1.0+RStudio Server 1.4+radian をセットアップする script。CRANパッケージは RStudio Package Manager のバイナリパッケージを利用
#!/bin/bash -x
## provisioning script for RStudio Server on ubuntu / WSL
## MRAN and RSPM libraries are fixed at 2021-08-09 (the last day before 4.1.1)
sudo apt update
sudo apt upgrade -y
# Japanese language support
sudo apt install -y language-pack-ja-base language-pack-ja fonts-noto-cjk
@turbotree
turbotree / 省市表
Created March 20, 2014 08:51
中国省市表(mysql版)
DROP TABLE IF EXISTS `province`;
CREATE TABLE `province` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=gbk;
-- ----------------------------
-- Records of province
-- ----------------------------
INSERT INTO `province` VALUES ('1', '北京市');