Skip to content

Instantly share code, notes, and snippets.

@sparkstar
sparkstar / random_image_generator.py
Last active January 16, 2023 19:19
[python] random image generator
"""
20180828 code fixed
$ pip freeze
numpy==1.15.1
Pillow==5.2.0
pkg-resources==0.0.0
"""
@jbnv
jbnv / NameGenPostgreSQLEnglish.sql
Created June 2, 2015 01:07
Name Generator (PostgreSQL; English)
SELECT
arrays.firstnames[s.a % ARRAY_LENGTH(arrays.firstnames,1) + 1] AS firstname,
substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ' from s.a%26+1 for 1) AS middlename,
arrays.lastnames[s.a % ARRAY_LENGTH(arrays.lastnames,1) + 1] AS lastname
FROM generate_series(1,300) AS s(a) -- number of names to generate
CROSS JOIN(
SELECT ARRAY[
'Adam','Bill','Bob','Calvin','Donald','Dwight','Frank','Fred','George','Howard',
'James','John','Jacob','Jack','Martin','Matthew','Max','Michael',
'Paul','Peter','Phil','Roland','Ronald','Samuel','Steve','Theo','Warren','William',
@Ciantic
Ciantic / dirname-filename-basename.bat
Created April 1, 2016 15:11
How to get filename, dirname, and basename in bat?
set filepath="C:\some path\having spaces.txt"
for /F "delims=" %%i in (%filepath%) do set dirname="%%~dpi"
for /F "delims=" %%i in (%filepath%) do set filename="%%~nxi"
for /F "delims=" %%i in (%filepath%) do set basename="%%~ni"
echo %dirname%
echo %filename%
echo %basename%
PASS src/isomorphic/classic/__tests__/ReactContextValidator-test.js
src/renderers/shared/shared/shouldUpdateReactComponent.js:26
Strict equal of different types: {"key":null,"ref":nu... (object) === false (boolean)
Strict equal of different types: [object Object] (object) === false (boolean)
src/renderers/shared/shared/shouldUpdateReactComponent.js:27
Strict equal of different types: {"key":null,"ref":nu... (object) === false (boolean)
Strict equal of different types: [object Object] (object) === false (boolean)
src/renderers/shared/stack/reconciler/ReactCompositeComponent.js:1258
'use strict';
class Abstract {
// A static abstract method.
static foo() {
if (this === Abstract) {
// Error Type 2. Abstract methods can not be called directly.
throw new TypeError("Can not call static abstract method foo.");
} else if (this.foo === Abstract.foo) {
// Error Type 3. The child has not implemented this method.
throw new TypeError("Please implement static abstract method foo.");
@nikhita
nikhita / update-golang.md
Last active June 7, 2025 02:17
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

@mraaroncruz
mraaroncruz / steps.md
Last active May 16, 2025 16:40
Get the Telegram channel ID

To get the channel id

  1. Create your bot with botfather
  2. Make you bot an admin of your channel

Simplest way (via @anhtuank7c)

Go to Telegram web and open a channel, get the ID from -[channel id] from hash in the path

https://web.telegram.org/k/#-9999999999999

@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active June 23, 2025 16:29
Conventional Commits Cheatsheet
@iPublicis
iPublicis / myapp-node-watcher.path
Last active October 31, 2024 12:55
NODE.JS app as a systemd service with CI controller
#########
# File: myapp-node-watcher.path
#
# Save this to /etc/systemd/system/
# Run systemctl enable myapp-node-watcher.path && systemctl daemon-reload && systemctl start myapp-node-watcher.path
#
[Path]
PathModified=/home/myuser/myappdir/public_html
[Install]
@gaearon
gaearon / uselayouteffect-ssr.md
Last active May 2, 2025 03:01
useLayoutEffect and server rendering

If you use server rendering, keep in mind that neither useLayoutEffect nor useEffect can run until the JavaScript is downloaded.

You might see a warning if you try to useLayoutEffect on the server. Here's two common ways to fix it.

Option 1: Convert to useEffect

If this effect isn't important for first render (i.e. if the UI still looks valid before it runs), then useEffect instead.

function MyComponent() {