Skip to content

Instantly share code, notes, and snippets.

@rnestertsov
rnestertsov / hddperftest
Created December 6, 2022 16:01 — forked from frozenice/hddperftest
quick perf test for the new Hetzner cloud volumes
# nbg1-dc3, CX11, Ubuntu 20.04, 10 GB EXT4 Volume
# local SSD
root@voltest:~# hdparm -Tt /dev/sda
/dev/sda:
Timing cached reads: 14624 MB in 1.99 seconds = 7341.48 MB/sec
@rnestertsov
rnestertsov / 55-bytes-of-css.md
Created September 28, 2022 07:58 — forked from JoeyBurzynski/55-bytes-of-css.md
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
.
├── books
│   ├── handlers.go
│   └── models.go
├── config
│   └── db.go
└── main.go
@rnestertsov
rnestertsov / go_time_parsing.md
Created January 13, 2021 08:39 — forked from unstppbl/go_time_parsing.md
Parsing custom time layout in Golang

There are some key values that the time.Parse is looking for.

By changing:

test, err := time.Parse("10/15/1983", "10/15/1983")

to

@rnestertsov
rnestertsov / mysql.sql
Created October 30, 2020 10:25 — forked from logrusorgru/mysql.sql
SQL: uniqueness, automatic created_at, updated_at refresh + soft delete. SQLite, PostgreSQL, MySQL
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
-- mysql --
-- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--
-- mysql <http://sqlfiddle.com/#!9/91afb5/2>
-- note: sqlfiddle is very stupid
@rnestertsov
rnestertsov / java_keystore.sh
Created February 18, 2019 19:11
Managing certificates in the Java keystore
#!/bin/sh
# Add certifiacte
sudo keytool -importcert -alias local-CA \
-keystore "$JAVA_HOME/jre/lib/security/cacerts" \
-file my_cert.crt
# get certificate
sudo keytool -list -keystore "$JAVA_HOME/jre/lib/security/cacerts" -alias local-CA
@rnestertsov
rnestertsov / jdbc-print-results.java
Created February 4, 2019 08:53
Print JDBC result set
private static void printResults(ResultSet rs) throws SQLException {
ResultSetMetaData rsMetadata = rs.getMetaData();
for (int i=1; i<=rsMetadata.getColumnCount(); i++) {
System.out.printf("%-15s | ", rsMetadata.getColumnName(i));
}
System.out.printf("\n");
while (rs.next()) {
for (int i=1; i<=rsMetadata.getColumnCount(); i++) {
@rnestertsov
rnestertsov / Dockerfile
Created January 15, 2019 14:22
Build docker image with java / maven / node
FROM centos:7.5.1804
ARG JDK_VERSION
ARG MAVEN_VERSION
ARG NODE_VERSION
RUN yum install -y \
wget \
java-${JDK_VERSION}-openjdk-devel
ENV JAVA_HOME /usr/lib/jvm/java-${JDK_VERSION}-openjdk/
@rnestertsov
rnestertsov / Makefile.md
Created June 27, 2018 06:45 — forked from subfuzion/Makefile.md
Makefile for Go projects

Go has excellent build tools that mitigate the need for using make. For example, go install won't update the target unless it's older than the source files.

However, a Makefile can be convenient for wrapping Go commands with specific build targets that simplify usage on the command line. Since most of the targets are "phony", it's up to you to weigh the pros and cons of having a dependency on make versus using a shell script. For the simplicity of being able to specify targets that can be chained and can take advantage of make's chained targets,

Snippet development
Quickly finding snippets
There are some ways you can quickly find a snippet file:
*
M-x yas/new-snippet
Prompts you for a snippet name, then tries to guess a suitable directory to store it, prompting you for creation if it does not exist. Finally, places you in a new buffer set to snippet-mode so you can write your snippet.