Skip to content

Instantly share code, notes, and snippets.

View xtrinch's full-sized avatar
🐱

Mojca Rojko xtrinch

🐱
View GitHub Profile
@anchan828
anchan828 / README.md
Last active July 22, 2024 10:33
This is an improvement to allow @nestjs/typeorm@8.1.x to handle CustomRepository. I won't explain it specifically, but it will help in some way. https://github.com/nestjs/typeorm/pull/1233

You need to provide some classes and decorators yourself to maintain the same style as typeorm@2.x.

1. EntityRepository -> CustomRepository

@EntityRepository(UserEntity)
export class UserRepository extends Repository<UserEntity> {}

var pg = require('pg');
var shimmer = require('shimmer');
function wrapQuery(orig, name) {
return function wrappedFunction(sql) {
console.time("PSQL: " +sql);
var args = arguments
var index = args.length - 1
@thoughtpolice
thoughtpolice / ecp5pll.py
Last active March 18, 2024 12:31
Yosys script to generate ECP5 PLLs on the fly
# ecp5pll.py: yosys RPC frontend for generating ECP5 PLL modules on the fly
#
# Copyright (C) 2020 Austin Seipp
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
@arielweinberger
arielweinberger / strong-password-regex.md
Last active September 8, 2024 06:47
Strong password Regular Expression - NestJS Course
  • Passwords will contain at least 1 upper case letter
  • Passwords will contain at least 1 lower case letter
  • Passwords will contain at least 1 number or special character
  • There is no length validation (min, max) in this regex!

Regular expression for JavaScript:

/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/
@rikka0w0
rikka0w0 / ft2232_to_digilent_jtag.md
Last active August 18, 2024 12:39
FT2232 to Digilent JTag for Xilinx FPGAs (ISE/Vivado)

The Digilent JTag uses FT2232, but its configuration EEPROM contains secrete data needed to be recoginzed by Xilinx ISE/Vivado. The following method only works on linux (tested on Ubuntu16.04), but the patched FT2232 doggle also works on Windows. Since WSL1 does not provide USB device access, the following method will not work for WSL1.

DONT use FT_Prog on offical Digilent cable, as it can trash the firmware! The offical eeprom contains secrete data that cannot be handled correctly by FT_Prog.

Here are steps to create a Digilent-like Jtag that can be used in Xilinx ISE and Vivado

  1. Install softwares: sudo apt-get install libftdi1 ftdi-eeprom
  2. Create a file "flash_digilent.conf" with the following content:
@ChristopherLaytonWasTakenSoIWentWithT
ChristopherLaytonWasTakenSoIWentWithT / index.html
Created July 18, 2018 05:28 — forked from nuta/index.html
CP2102 (used by ESP32-DevKitC) WebUSB device driver
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>esptool.js</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xterm/2.9.2/xterm.min.js" integrity="sha256-8rsVcpCnO6HdeJL84i0VdubjM42fjSmO8aONghdq3gc=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/xterm/2.9.2/xterm.min.css" integrity="sha256-w69o8Y6P5VZjfYFmn2KlqMU7TUi2I+oWObi8FLlVZZg=" crossorigin="anonymous" />
</head>
@xtrinch
xtrinch / mock-binary-websocket.py
Last active November 25, 2017 01:16
Simple websocket binary data send simulation
#!/usr/bin/env python
import time
import socket
HOST = 'localhost'
PORT = 9876
ADDR = (HOST, PORT)
serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serversocket.bind(ADDR)
@theplatapi
theplatapi / gist:0a7d789afc8028a3c20b
Last active November 26, 2023 05:55
Draw a rectangle in Cesium with shift-click-drag
var viewer = new Cesium.Viewer('cesiumContainer', {
targetFrameRate: 60,
homeButton: false,
sceneModePicker: false,
navigationHelpButton: false,
baseLayerPicker: false,
clock: new Cesium.Clock({
startTime: Cesium.JulianDate.fromIso8601('1880-01-01'),
currentTime: Cesium.JulianDate.fromIso8601('1880-01-01'),
stopTime: Cesium.JulianDate.fromIso8601("2013-12-01"),
@thisismitch
thisismitch / corridors_of_code.rb
Created November 18, 2015 05:36
Sonic Pi Songs
# Chrono Trigger Soundtrack - Corridors of Time
# plug this into http://sonic-pi.net/
# still needs synth pads
# global config
use_bpm 112
def play_legato_note(note_value, duration)
release_duration = duration
@paulirish
paulirish / what-forces-layout.md
Last active September 20, 2024 21:16
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent