Skip to content

Instantly share code, notes, and snippets.

View tlylt's full-sized avatar

Liu Yongliang tlylt

View GitHub Profile
\du
ALTER USER yourusername WITH PASSWORD 'yournewpass';
CREATE USER yourname WITH SUPERUSER PASSWORD 'yourpassword';
celery -A project-name worker --pool=solo -l info
# How to solve install issue of WSL in Windows 10
Rename Ubuntu.1604.2017.711.0_v1.appx to Ubuntu.1604.2017.711.0_v1.zip and extract all in to a folder.
Run Ubuntu.exe inside the extracted folder.
def combinations(lst,n):
if n == 1: # every item is a combination
return list(map(lambda x: [x], lst))
elif len(lst) == n: # there is only one combination
return [list(lst)]
else:
first = lst[0]
rest = lst[1:]
# similar to coin change, either include or not include the first item
# if include the first item, add first to the combinations of the rest items that form n-1 combi
https://docs.djangoproject.com/en/3.0/intro/reusable-apps/
@tlylt
tlylt / test6.jsh
Last active September 7, 2020 03:44
Lab 2 Level 6 test file
/open Cruise.java
/open SmallCruise.java
/open BigCruise.java
/open Loader.java
/open RecycledLoader.java
/open level6.jsh
Cruise[] cruises = {
new BigCruise("B1111", 0, 60, 1500),
new SmallCruise("S1112", 0),
new BigCruise("B1113",30, 100,1500),
@tlylt
tlylt / compareDouble.java
Created September 25, 2020 08:45
Compare two double in Java
boolean closeEnough(double a, double b) {
double tolerance = 1E-4;
return Math.abs(a-b) < tolerance;
}
@tlylt
tlylt / .manifest
Created March 16, 2021 10:58 — forked from devjin0617/.manifest
chrome extension using a content script to access the `window` object
{
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"js": ["inject.js"],
"all_frames": true
}
],
"web_accessible_resources": [
"content.js"
@tlylt
tlylt / gist:8c55589cec793bb4104f990ec5328f07
Created May 21, 2021 05:45
Cypress upload excel file
it('uploads a file', () => {
cy.fixture('sample.xlsx','binary').as('sample')
cy.get('input[type="file"]').then(function (el) {
const blob = Cypress.Blob.binaryStringToBlob(this.sample)
const file = new File([blob], 'sample.xlsx', { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
const list = new DataTransfer()
list.items.add(file)
const myFileList = list.files
el[0].files = myFileList
el[0].dispatchEvent(new Event('change', { bubbles: true }))

Responsive Ferris Wheel - CSS Only animation

CSS keyframe Ferris-wheel animation. Easy to adjust speed and responsive.

A Pen by Jimba Tamang on CodePen.

License.