Skip to content

Instantly share code, notes, and snippets.

View itslijohnny's full-sized avatar

Johnny Li itslijohnny

View GitHub Profile
@itslijohnny
itslijohnny / batched_generation_with_donut.ipynb
Created February 3, 2024 23:26
Batched_generation_with_Donut.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@itslijohnny
itslijohnny / how-to-use-dateparser.md
Last active February 3, 2024 04:46
How to use dateparser
from data parser.search import search_dates
search_setting = {"REQUIRE_PARTS": ["month","day", "PREFER_DAY_OF_MONTH":"last"}
matches=search_dates(text, settings=search_settings)
@itslijohnny
itslijohnny / gist:72ff4340f7d90c277427971e6271f555
Last active September 15, 2020 00:10
my auto hot key script
CapsLock::
IsKey := false
Input, key, B C L1 T1, {Esc}
IsKey := true
if (ErrorLevel = "Max")
Send, % "^" key
KeyWait, CapsLock
return
CapsLock up::
if !IsKey
@itslijohnny
itslijohnny / run_command.py
Created October 29, 2019 21:21
Run CLI command and return output.
def run_command(command):
process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE, encoding='utf8')
while True:
output = process.stdout.readline()
if output == '' and process.poll() is not None:
break
if output:
print (output.strip())
rc = process.poll()
return rc
@itslijohnny
itslijohnny / i3-gaps.sh
Created June 26, 2019 02:54 — forked from dabroder/i3-gaps.sh
Install i3-gaps on ubuntu 18.04
#!/bin/bash
sudo apt install -y libxcb1-dev libxcb-keysyms1-dev libpango1.0-dev libxcb-util0-dev libxcb-icccm4-dev libyajl-dev libstartup-notification0-dev libxcb-randr0-dev libev-dev libxcb-cursor-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev autoconf libxcb-xrm0 libxcb-xrm-dev automake
cd /tmp
# clone the repository
git clone https://www.github.com/Airblader/i3 i3-gaps
cd i3-gaps
# compile & install
@itslijohnny
itslijohnny / find_primer_factors.py
Created April 6, 2019 22:22
Find a number's prime factors
# The input number
input = 7140229933
# Function of checking wether a numner is a prime number
def if_pre(n):
for i in range(2,n):
if n%i == 0:
return False
break
else:
@itslijohnny
itslijohnny / docker-clean.md
Created March 1, 2019 07:22
Cleanup docker images and containers after failed builds

Cleanup docker images and containers after failed builds

Sometimes, there are some untagged images left behind after failed builds. In order to get rid of those, this script can be used.

#!/bin/bash
docker rm $(docker ps -aq)
docker rmi $(docker images | grep "^<none>" | awk '{print $3}')
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
</component>