App-Cheats
view release on metacpan or search on metacpan
# Step 3: Delete secret key:
gpg --delete-secret-keys YOUR_ID
#
# Step 4: Delete public key:
gpg --delete-keys YOUR_ID
# Delete all keys.
gpg --delete-key 'Tim Potapov'
gpg --delete-secret-key 'Tim Potapov'
#############################################################
## HTML Attribute - href
#############################################################
# Run a javascript function when clicking a link instead of going to a page
<a class="myWrapper" href="javascript:myFunc()"><div class="myText">+</div></a>
#############################################################
## HTML Element - details
#############################################################
# Create an automatically foldable element in HTML
<details>
<summary>Quick summary</summary>
<h1>All details start here</h1>
<p>and continue till the end</p>
</details>
#############################################################
## HTML Unicode
#############################################################
# HTML Unicode. ZERO WIDTH SPACE.
​ // e2808b
# Zero-width Unicode characters table:
ZERO WIDTH SPACE (U+200B)
Used to indicate word boundaries or add spacing without
affecting the layout visibly.
---
ZERO WIDTH NON-JOINER (U+200C)
Prevents ligatures or joinings between characters, commonly
used in scripts like Arabic and Persian.
---
ZERO WIDTH JOINER (U+200D)
Indicates that two characters should be joined together as
a single glyph.
---
LEFT-TO-RIGHT MARK (U+200E)
Indicates that text following it should be displayed left-
to-right, useful for mixing text with different
directionalities.
---
RIGHT-TO-LEFT MARK (U+200F)
Indicates that text following it should be displayed right-
to-left.
---
LEFT-TO-RIGHT EMBEDDING (U+202A)
Embeds text with a left-to-right directional override.
---
RIGHT-TO-LEFT EMBEDDING (U+202B)
Embeds text with a right-to-left directional override.
---
POP DIRECTIONAL FORMATTING (U+202C)
Resets the directionality to the surrounding context.
---
LEFT-TO-RIGHT OVERRIDE (U+202D)
Forces text to be displayed left-to-right, overriding the
surrounding context.
---
RIGHT-TO-LEFT OVERRIDE (U+202E)
Forces text to be displayed right-to-left, overriding the
surrounding context.
# zero-width Unicode characters example.
perl -C -E 'say "<!START_\N{ZERO WIDTH SPACE}A\N{LEFT-TO-RIGHT MARK}B\N{RIGHT-TO-LEFT MARK}C\N{ZERO WIDTH NON-JOINER}-->"'
# Output:
<!START_âAâBâCâ-->
# Zero-width example of hiding text in a text area (plain text,POC)
perl -C -Me -E 'sub _BuildMark{ unpack("B*", "<!$_[0]-->") =~ tr/01/\N{ZERO WIDTH SPACE}\N{LEFT-TO-RIGHT MARK}/r } my $B = join "", _BuildMark("START_ABC"), "Line1: Ok\nLine2: NOk", _BuildMark("END_ABC"); say $B; d $B'
Line1: Ok
Line2: NOk
# Zero-width example of hiding text in a text area (plain text, POC, WIP)
perl -C -Me -E 'sub _BuildMark{ unpack("B*", "<!$_[0]-->") =~ tr/01/\N{ZERO WIDTH SPACE}\N{LEFT-TO-RIGHT MARK}/r } sub _ContainsMark { index(shift, _BuildMark(shift)) != -1 } $_ = join "", "Before\n", _BuildMark("START_ABC"), "Line1: Ok\nLine2: NOk",...
#############################################################
## HTML - Validation
#############################################################
# Input element validation in html (check,regex)
<input name="NAME" type="number" placeholder="?" step="any" class="value" style="grid-column: 5 / 6; grid-row: 2 / 3;" value="4.000">
<input name="name" type="text" pattern="^[-\ẘ̟̚\.,_]+$" value="VALUE">
#############################################################
## Java
#############################################################
# Compile a java program (script)
javac hello.java
# Run a java program (execute script)
java hello
#############################################################
## Javascript - General
#############################################################
# Efficient way in javascript to insert text as html (append to body)
document.querySelector('#id').insertAdjacentHTML('beforeEnd', to_add)
# (works fast, but script tags are not usable).
#
# Use this to allow using script tags
$(id).append(details_rc);
# Stack trace in javascript (js).
try {
else {
query = m_interface->prepare("SELECT name FROM PRAGMA_TABLE_INFO(:table)"); // column names
query.bind(":table", table);
# Get all columns names from SQLite
sqlite3 my.db "PRAGMA table_info(myTable)"
#
sqlite3 my.db "SELECT name FROM pragma_table_info('myTable') ORDER BY name"
# Provide default for null values using COALESCE (sqlite3)
SELECT DISTINCT COALESCE(col,'NULL') FROM myTable ORDER BY col ASC
# SQLite if/else, concat(merge) columns(strings)
SELECT name,
CASE WHEN var1 = 1 THEN 'x' ELSE '-' END ||
CASE WHEN var2 = 1 THEN '/x' ELSE '/-' END ||
CASE WHEN var3 = 1 THEN '/x' ELSE '/-' END ||
CASE WHEN var4 = 1 THEN '/x' ELSE '/-' END
AS var
FROM myTable
ORDER BY name;
# SQL inner join to get a summary of possibilities
sqlite3 my2.db "SELECT DISTINCT col1,col2 FROM myTable AS INNER JOIN (SELECT col1 FROM tool_types GROUP BY col1) USING(col1) INNER JOIN (SELECT col FROM tool_types GROUP BY col) USING(col) ORDER BY col1,col ASC"
# Avoid using "NOT IN" (SQL)
http://www.dbatodba.com/sql-server/how-tos/typical-solutions-to-avoid-using-not-in-on-sql-server/
# NOT IN works, but as the number of records grows, NOT IN performs worse
# Fastest solution so far (Using LEFT JOIN)
#
# Final query
SELECT t1.name,t1.changed
FROM
myTable1 AS t1
LEFT OUTER JOIN
(SELECT * FROM myTable2 WHERE id='123') AS t2
ON t1.name=t2.uid
WHERE
t2.changed IS NULL
OR
t1.changed!=t2.changed;
# Switch statement in SQLite3
SELECT
CASE WHEN item IS NULL THEN 'NULL'
WHEN item = 0 THEN '?'
WHEN item = 1 THEN 'Dummy'
WHEN item = 2 THEN 'Adapter'
ELSE item
END AS item2
FROM
queue
#############################################################
## Stegohide
#############################################################
# Hide a file inside of another file,
# then get it back.
steghide embed -cf COVER.jpg -ef SECRET_TO_EMBED
steghide extract -sf COVER.jpg
#############################################################
## Sublime Editor
#############################################################
# Duplcate a line (sublime editor)
Control + Shift + D
# Vertical Column Edit (like vim,sublime editor)
Shift + Right Click
# Cut line (sublime editor)
Control + x
# Upper case the highlighted word (sublime editor)
Control + K + U
# Lower case the highlighted word (sublime editor)
Control + K + L
#############################################################
## Telegram
#############################################################
# Install telegram-send
sudo apt install pip
sudo pip install telegram-send
#############################################################
## Trello
#############################################################
# Make a hyperlink in Trello
# Create a link by putting:
# 1. The link text in brackets.
# 2. The URL in parentheses.
# With no space between ] and (
[this](Trello)
# Show card count in Trello.
Filter: *
#############################################################
## Termux
#############################################################
# Add 2nd row to termux.
vi $HOME/.termux/termux.properties
#
+ # Ignore bell character
+ bell-character=ignore
+
+ # Only works on newer phones
+ # extra-keys = [ \
+ # ['ESC','|','/','HOME','UP','END','PGUP','DEL'], \
( run in 0.513 second using v1.01-cache-2.11-cpan-71847e10f99 )