Skip to content

Instantly share code, notes, and snippets.

View shchemelevev's full-sized avatar

Yevgenii Shchemelev shchemelevev

View GitHub Profile
@aputs
aputs / logrotate-nginx
Created June 12, 2010 03:04
logrotate config for nginx
/var/log/nginx_*.log {
daily
compress
delaycompress
rotate 2
missingok
nocreate
sharedscripts
postrotate
test ! -f /var/run/nginx.pid || kill -USR1 `cat /var/run/nginx.pid`
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active July 18, 2024 22:25
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@aspyct
aspyct / wpa_supplicant.conf
Created September 17, 2018 13:10
Connect to a WPA2 Enterprise network with wpa_supplicant with this .conf file. I used this to connect to my university's wireless network.
# Connect to a WPA2 Enterprise network with wpa_supplicant with this .conf file.
# I used this to connect to my university's wireless network on Arch linux.
# Here's the command I used:
#
# wpa_supplicant -i wlan0 -c ./wpa_supplicant.conf
#
network={
ssid="YOUR_SSID"
scan_ssid=1
@jimmychu0807
jimmychu0807 / string-conversion.rs
Created November 21, 2019 10:20
Conversion between String, str, Vec<u8>, Vec<char> in Rust
use std::str;
fn main() {
// -- FROM: vec of chars --
let src1: Vec<char> = vec!['j','{','"','i','m','m','y','"','}'];
// to String
let string1: String = src1.iter().collect::<String>();
// to str
let str1: &str = &src1.iter().collect::<String>();
// to vec of byte
@pfernandez
pfernandez / neovim-iterm2-semantic-history.md
Last active June 29, 2023 11:03
Command-click a file in iTerm2 to open it in an existing instance of Neovim
  1. Install neovim: brew install neovim
  2. Install neovim-remote: pip3 install neovim-remote
  3. In iTerm2, go to Preferences -> Profiles -> Advanced, select Semantic History -> Run coprocess, and paste this in:
n=/usr/local/bin/nvr; s="$n --serverlist | tail -n1"; c="$n --servername `$s` --remote-silent"; [ -z "\2" ] && $c \1 || $c +\2 \1

Then command-click a filepath (with optional line number) in iTerm to open the file. Neovim must already be open, and the most recently opened running instance will be used.

You can also achieve this with macvim, but only neovim works in the terminal.

@daxav
daxav / $My Anki Wanikani Ultimate 2 Changes
Created February 27, 2021 16:33
My Anki Wanikani Ultimate 2 Changes
Changes for the scripts of the Anki Wanikani Ultimate 2 deck, feel free to use them how you like.
Features:
- Automatic Romaji to Kana conversion in reading input using WanaKana.
- Multiple input support (separated by a space for readings and by a comma for meanings,
eg: "axe, loaf bread counter" or "あめ あま").
- Shows each right and wrong answer from your input.
- Automatic resizing of characters for small screens.
- Reordered the Back template of the cards to be more similar to the Wanikani site (reading related things come first in reading cards,
same for meaning).