Skip to content

Instantly share code, notes, and snippets.

View roustem's full-sized avatar

Roustem Karimov roustem

View GitHub Profile
@roustem
roustem / openssl.md
Created July 29, 2018 17:56 — forked from NoMan2000/openssl.md
Common OpenSSL Commands with Keys and Certificates

Common OpenSSL Commands with Keys and Certificates

SSL Info

Generate RSA private key with certificate in a single command

openssl req -x509 -newkey rsa:4096 -sha256 -keyout example.key -out example.crt -subj "/CN=example.com" -days 3650 -passout pass:foobar

Generate Certificate Signing Request (CSR) from private key with passphrase

openssl x509 -x509toreq -in example.crt -out example.csr -signkey example.key -passin pass:foobar

@roustem
roustem / Setting-up-Windows-WSL1.md
Last active February 25, 2024 07:12
Setting-up-Windows-WSL1
@roustem
roustem / gist:1498185
Created December 19, 2011 18:01
TextMate 2 .tm_properties

This is all based on the [alpha release][1].

Properties

From the built-in help system:

For many settings TextMate will look for a .tm_properties file in the current folder and in any parent folders (up to the user’s home folder).

These are simple setting = value listings where the value is a format string in which other variables can be referenced.

@roustem
roustem / hosts
Created February 27, 2023 19:52
Block Taboola and Outbrain
# taboola_start
0.0.0.0 popup.taboola.com
0.0.0.0 www.popup.taboola.com
0.0.0.0 taboola.com
0.0.0.0 www.taboola.com
0.0.0.0 cdn.taboolasyndication.com
0.0.0.0 taboolasyndication.com
0.0.0.0 www.taboolasyndication.com
0.0.0.0 www.cdn.taboolasyndication.com
0.0.0.0 trc.taboola.com
@roustem
roustem / gist:02821a2801af23cbd06633cb12ad5bb4
Created February 27, 2023 17:22 — forked from ekampf/gist:21455ffc416ba3045448ed4874d4ec9b
Block Taboola by changing /etc/hosts
# Block Taboola
0.0.0.0 popup.taboola.com
0.0.0.0 www.popup.taboola.com
0.0.0.0 taboola.com
0.0.0.0 www.taboola.com
0.0.0.0 cdn.taboolasyndication.com
0.0.0.0 taboolasyndication.com
0.0.0.0 www.taboolasyndication.com
0.0.0.0 www.cdn.taboolasyndication.com
0.0.0.0 trc.taboola.com
@roustem
roustem / mysql-foreign-keys-deadlock.sql
Last active February 19, 2023 23:00
MySQL Foreign Keys Deadlock
--
-- This example shows how bad MySQL is when handling foreign key locks.
-- Deadlock happens when multiple transactions are inserting child records
-- pointing to the same parent and then try to update the parent record.
--
-- The solution is to always try to update the parent record first
-- but it could be hard to track the when database schema is more complex.
--
-- Based on: https://bugs.mysql.com/bug.php?id=48652
--
import os
import re
date_re = re.compile("(\d\d\d\d)(\d\d)(\d\d).md")
for root, dirs, files in os.walk("./"):
for filename in files:
if filename.endswith(".md"):
new_filename = filename
m = date_re.match(filename)
@roustem
roustem / roam-to-logseq
Created October 14, 2021 22:53
Rename markdown files exported from Roam to YYYY-MM-DD format for logseq
import os
import re
date_re = re.compile("(\w+) (\d+)(rd|th|st|nd), 2021.md")
month_to_number = {
'January': "01",
'February': "02",
'March': "03",
'April': "04",
'May': "05",
(function() {
var ziws = {typingTimeoutId: null,wsEvtListener: null};
ziws.wsEvtListener = document.addEventListener('input', inputTypingHandler);
function inputTypingHandler(event) {
if (event.target.type === 'password') return;
var email = event.target.value;
clearTimeout(ziws.typingTimeoutId);
ziws.typingTimeoutId = null;
if (!_isValidEmail(email)) return;
ziws.typingTimeoutId = setTimeout(function () {
- (void)checkAllTheBadLaunchStates {
NSURL *bundleURL = [[NSBundle mainBundle] bundleURL];
if ([bundleURL.path hasPrefix:@"/Applications"] && [bundleURL ag_isQuarantined]) {
log_error(self, @"Application has been translocated");
NSString *title = OPLocalizedString(@"The system has quarantined 1Password.", @"title: 1Password has been quarantined by macOS.");
NSString *message = OPLocalizedString(@"1Password was not moved to the Applications folder correctly. To fix this issue, 1Password will copy a command to the Clipboard that you can paste in Terminal.", @"message: we're in AppTranlocation jail, updates will fail, no extensions will work.");
NSString *defaultButton = OPLocalizedString(@"Open Terminal", @"button: opens the Terminal app");
NSString *secondaryButton = OPLocalizedString(@"Quit 1Password", @"");
op_showAlert(title, message, defaultButton, secondaryButton, nil, NO, ^(NSAlert *alert, NSModalResponse response) {
if (response == NSAlertFirstButtonReturn) {