全部 创建

user:thomas 由用户创建的gist

title:mygist 给定标题的gist

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

登录


全部 创建 登录

所有 Gists

最近 创建
最早 创建
最近 更新
最早 更新
kristofer's Avatar

kristofer / symboltable2.md

0 喜欢
0 派生
1 文件
最后活跃于 1716315910

describe how you would use python's dict data structure to build a symbol table for a small language compiler

TinyLlama

In a small language compiler like Python, the goal is to convert an input program into a bytecode that can be executed by an interpreter. This bytecode is then translated into machine code (CPU instructions) and executed by a CPU, or run directly in a virtual machine (VM). The intermediate representation for this process is called a symbol table,

kristofer's Avatar

kristofer / symboltable1.md

0 喜欢
0 派生
1 文件
最后活跃于 1716315925

describe how you would use python's dict data structure to build a symbol table for a small language compiler

Phi3

Building a symbol table using Python's dictionary data structure for a small language compiler involves several steps. The symbol table will be used to keep track of variables, their types, and scopes during the compilation process. Here's how you can implement it:

  1. Define basic classes
kristofer's Avatar

kristofer / What's running on a port?

0 喜欢
0 派生
1 文件
最后活跃于 1715607468
for macOS

To find what's running on Port#

# macos
sudo lsof -i :<PortNumber>
# should return a PID as first number
kill -9 <PID>
kristofer's Avatar

kristofer / docker boot.md

0 喜欢
0 派生
1 文件
最后活跃于 1715607326

Get Spring/jhipster running in Docker container

On the mac you'll need to download Docker Desktop

This provides the docker commands on the Mac

Not sure if you need to download and install docker-compose or not....

./mvnw package -Pprod verify jib:dockerBuild

kristofer's Avatar

kristofer / Python OOP Sample

0 喜欢
0 派生
1 文件
最后活跃于 1715362413
1 # here is a very simple example of python OOP
2
3 # normal hello-world
4 print("1 Hello World!")
5
6 # an OOP version
7
8 class HelloWorld:
9 def main(self):
10 print("2 Hello World!")
kristofer's Avatar

kristofer / S3 Access (java, Python)

0 喜欢
0 派生
4 文件
最后活跃于 1758032090
Some samples of working with S3 on AWS.
1 import boto3
2 from botocore.exceptions import ClientError, NoCredentialsError
3 import os
4 from pathlib import Path
5
6 class S3BucketManager:
7 def __init__(self, bucket_name, region_name='us-east-1'):
8 """
9 Initialize S3 client and set bucket name
10
dasha's Avatar

dasha / gist:96cdfa4bcaa24a0b9bcab1a04d8babd4

0 喜欢
0 派生
1 文件
最后活跃于 1715195787
1 export JAVA_HOME=`/usr/libexec/java_home -v 21.0.2`
dasha's Avatar

dasha / gist:2a139a024b97494aa56a5732cc49d631

0 喜欢
0 派生
1 文件
最后活跃于 1715191641
1 Error 86:
2
3 #!/bin/bash
4
5 # Loop through all directories in PATH
6 for dir in ${PATH//:/ }; do
7 echo "$dir"
8 # Check if directory exists before trying to access
9 if [ -d "$dir" ]; then
10 # Loop through executable files in this directory
kristofer's Avatar

kristofer / Git Tricks

0 喜欢
0 派生
1 文件
最后活跃于 1747851123

For re-doing the repo, to take into account your changes to the .gitignore

Remove Stuff that should ignored. (like class files (java) or .pyc files (python)) Don't Store node_modules either!

The series of commands below will remove all of the items from the Git Index (not from the working directory or local repo), and then updates the Git Index, while respecting git ignores. PS. Index = Cache

First:

git rm -r --cached . 
kristofer's Avatar

kristofer / Highlight Code for Keynote

0 喜欢
0 派生
1 文件
最后活跃于 1715189764

Highlight Code for Keynote

https://gist.github.com/jimbojsb/1630790
https://medium.com/@bucknall/tricks-for-presenting-code-in-keynote-72f11a1524c2

highlight -O rtf my file.py | pbcopy

更新 更早

由 Opengist 强力驱动 ⋅ Load: 170ms⋅

中文
Čeština Deutsch English Español Français Magyar Italiano Português Русский Türkçe Українська 中文 繁體中文