Skip to content

Instantly share code, notes, and snippets.

View ksylvan's full-sized avatar

Kayvan Sylvan ksylvan

View GitHub Profile
ksylvan / current-date-and-time.applescript
Created October 10, 2023 21:58 — forked from Glutexo/current-date-and-time.applescript
AppleScript to get current date and time (YYYY-MM-DD HH:MM:SS). Usable as a Text Service in Mac OS X.
The zero_pad function taken from:
on zero_pad(value, string_length)
set string_zeroes to ""
set digits_to_pad to string_length - (length of (value as string))
if digits_to_pad > 0 then
repeat digits_to_pad times
set string_zeroes to string_zeroes & "0" as string
ksylvan / Join Zoom.scpt
Created October 6, 2023 01:30 — forked from JacksonChen666/Join Zoom.scpt
Join zoom at the speed of computers (AppleScript)
# It is recommended that you save this script as an application, so you don't have to open Script editor.
It all started when I wanted to join zoom faster than a human could do with no prompt like how I expected like this.
I first discovered's URL scheme to join meeting, but when I found out it doesn't work, I started to make this program.
After this all of stuff, I finally have something that is constantly updated.
After this pandemic is over, development might slow down or become discontinued.
global meetingNames, meetingIDs, meetingPwds, wname
# Compiling the app will reset all your saved meetings!
property meetingNames : {}
ksylvan /
Last active May 5, 2023 18:45
Job Requirements

Backend Developer:

Backend development expertise:

  • Design, implement, optimize scalable systems
  • Microservices architecture, serverless computing

Java proficiency:

  • Java knowledge, ecosystem
  • Java frameworks: Spring, Hibernate, Java EE
  • Modern Java libraries, tools, best practices
ksylvan /
Created April 23, 2023 23:52 — forked from f0k/
Simple python script to obtain CUDA device information
#!/usr/bin/env python
# -*- coding: utf-8 -*-
Outputs some information on CUDA-enabled devices on your computer,
including current memory usage.
It's a port of
from C to Python with ctypes, so it can run without compiling anything. Note
that this is a direct translation with no attempt to make the code Pythonic.
ksylvan / How-to-Symbolize-MacOSX-Crash-Dump
Created December 9, 2020 16:21 — forked from jerrykrinock/How-to-Symbolize-MacOSX-Crash-Dump
How to symbolize a crash dump in Mac OS X, given a crash dump or exception log. Includes some steps and tips I've collected that are missing in Apple's TN2123. One time I tried this using lldb instead of gdb but it didn't work.
1) Move/copy both the crashing .app and the relevant.dSYM files into the same directory.
2) If the crash was in a framework, dynamic library, or bundle, you have position-independent code and must work out the *slide*. Otherwise, skip up to step 9 and use slide=0.
3a) If you have a crash dump, look in the *Binary Images* part of the crash log and find the framework, dynamic libray or bundle in which the crash occurred. Read the first column of the output. This is the address at which the __TEXT segment was loaded. We call it the *Actual Load Address* and denote it as *A*.
ksylvan /
Last active June 11, 2020 22:46
from random import randrange
class MinesGrid:
# Implement a sparse array to optimize space.
MINE = -1
class Row:
# Each row in the __a dict has the following
# structure a list, containing:
# [ empty_cells, {} ]
ksylvan /
Last active May 4, 2020 00:52
Euler 17 in Python: Number to words
# 1 <= T <= 10
# 0 <= N <= 1e12
# 1e3 = Thousand
# 1e6 = Million
# 1e9 = Billion
# 1e12 = Trillion
# Project Euler 17
ksylvan /
Created March 28, 2020 06:46
Justified Text question
# Question Description: Write a function that takes, as arguments, an integer representing line length in
# characters and a (long) string of text and returns the text with spaces and line breaks to produce a block of
# text justified to the given line length. For example, if the function were called as
# justify(25, "This is some sample text, really just enough to generate a few lines in the output to show what the text justify function is supposed to do.")
# This is some sample text,
# really just enough to
# generate a few lines in
# the output to show what
ksylvan /
Last active March 18, 2020 06:27
OurString and hasNext and getNext
# _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
# |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
# | | | |
# |H| |L| |W| |D|
# |E| |O| |O| |!|
# |L| |R|
# |L|
ksylvan /
Last active March 13, 2020 23:50
Simple Calculator
# You are building an educational website and want
# to create a simple calculator for students to use.
# The calculator will only allow addition and subtraction
# of non-negative integers.
# We also want to allow parentheses in our input.
# Given an expression string using
# the "+", "-", "(", and ")"
# operators like "5+(16-2)", write a function to parse the
# string and evaluate the result.