Skip to content

Instantly share code, notes, and snippets.

@bsun0802
bsun0802 / GeneImage.py
Created January 16, 2022 22:46 — forked from parashardhapola/GeneImage.py
A pure python code to draw gene diagrams with introns and exons and draw markers ('lollipops') at random positions on the gene
import matplotlib.pyplot as plt
"""
MIT License
Copyright (c) [2016] [Parashar Dhapola]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@wassname
wassname / CausalConv2d.py
Last active May 10, 2024 15:43
pytorch Causal Conv2d
from torch.nn.modules.utils import _pair
class CausalConv2d(nn.Conv2d):
def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=None, dilation=1, groups=1, bias=True):
kernel_size = _pair(kernel_size)
stride = _pair(stride)
dilation = _pair(dilation)
if padding is None:
padding = [int((kernel_size[i] -1) * dilation[i]) for i in range(len(kernel_size))]
@acarril
acarril / bootable-win-on-mac.md
Created November 18, 2022 17:49
Create a bootable Windows USB using macOS

For some reason, it is surprisingly hard to create a bootable Windows USB using macOS. These are my steps for doing so, which have worked for me in macOS Monterey (12.6.1) for Windows 10 and 11. After following these steps, you should have a bootable Windows USB drive.

1. Download a Windows disc image (i.e. ISO file)

You can download Windows 10 or Windows 11 directly from Microsoft.

2. Identify your USB drive

After plugging the drive to your machine, identify the name of the USB device using diskutil list, which should return an output like the one below. In my case, the correct disk name is disk2.

@ccstone
ccstone / Create date-string using ICU Date-Time Format Syntax.applescript
Last active May 10, 2024 15:42
Use AppleScriptObjC (ASObjC) to Create a date-string using ICU Date-Time Format Syntax
-------------------------------------------------------------------------------------------
# Auth: Shane Stanley & Christopher Stone
# dCre: 2014/01/19 09:46 +1100
# dMod: 2016/02/24 15:18 -0600
# Appl: AppleScriptObjC
# Task: Create a date-string using ICU Date-Time Format Syntax
# : http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @AppleScriptObjC, @ASObjC, @Shane, @Date, @String
@ccstone
ccstone / 0_reuse_code.js
Created January 29, 2016 05:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ccstone
ccstone / Desktop_Sweeper.applescript
Last active May 10, 2024 15:41
An Applescript to sweep your desktop.Creates a dated folder inside ~/Documents/Sweep Desktop/ with newly swept items.Items may be grouped using their file extension (examples provided in the script).Items may be excluded by name, and items labeled with green, gray, or red are automatically excluded.
------------------------------------------------------------------------------------------------
# 2015/10/03 10:42
# NOTE: El Capitan breaks the whose clauses in this.
# They still work but take 30+ seconds instead of 3-4.
# I will update this with ASObjC when I get the chance.
------------------------------------------------------------------------------------------------
# Auth: Christopher Stone <junksieve@thestoneforge.com>
# dCre: 2012-09-30 : 16:51
# dMod: 2013-06-20 : 10:35
# Appl: Finder
@ccstone
ccstone / Edit_Email_in_BBEdit.applescript
Created June 25, 2013 19:29
This script will find the selected email message with Spotlight and open it in BBEdit for editing.<p> (Change "BBEdit" to "TextWrangler" to use the free version of BBEdit instead.)
-------------------------------------------------------------------------------------------
# Auth: Christopher Stone <junksieve@thestoneforge.com>
# dCre: 2012-07-18 : 05:51
# dMod: 2013-06-25 : 14:26
# Appl: Mail & BBEdit
# Task: Open selected message's file in BBEdit for editing.
# Deps: Uses only OSX components.
# Test: Lion & Mountain Lion (might work in Snow Leopard but I cannot test).
# Tags: @Applescript, @Mail, @BBEdit, @Edit, @Message
-------------------------------------------------------------------------------------------
Here are some products that you can use to build your fintech app
## SMS
Termii
Twilio
Interswitch Digital (Vanso)
## Card and account charge
@ccstone
ccstone / BBEdit-TextWrangler_RegEx_Cheat_Sheet.txt
Last active May 10, 2024 15:41
BBEdit-TextWrangler Regular Expression Cheat-Sheet
————————————————————————————————————————————————————————————————————————————————————————————————————
BBEdit / BBEdit-Lite / TextWrangler Regular Expression Guide Modified: 2018/08/10 01:19
————————————————————————————————————————————————————————————————————————————————————————————————————
NOTES:
The PCRE engine (Perl Compatible Regular Expressions) is what BBEdit and TextWrangler use.
Items I'm unsure of are marked '# PCRE?'. The list while fairly comprehensive is not complete.
@diffficult
diffficult / bluetoothdoubledipping.md
Last active May 10, 2024 15:41
Bluetooth Pairing one device on Dual Boot of Windows & Linux - Stop having to Pair Devices

Bluetooth Pairing one device on Dual Boot of Windows & Linux - Stop having to Pair Devices

You may have experienced when dual booting that you need to re-pair your bluetooth devices (ie., Headphones, mouse, keyboard, etc) this usually happens because you have already paired the device with another operating system using the same bluetooth adapter when dual booting (either Linux or Windows).

Some devices cannot handle multiple pairings associated with the same MAC address (ie., bluetooth adapter). As per suggested on the ArchWiki you can fix this by re-pairing the device each time, but there's actually another solution to not do so each time you choose to use your device on a different OS.

How can we accomplish this?

Easy, just pair the device on a OS and copy the bluetooth keys generated to the other OS so our device doesn't notice the difference.