Skip to content

Instantly share code, notes, and snippets.

View Wqrld's full-sized avatar
🌍
Discord: Wqrld#7373

Wqrld Wqrld

🌍
Discord: Wqrld#7373
View GitHub Profile
@Wqrld
Wqrld / .bashrc.sh
Created June 15, 2024 14:27
hetzner .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
if [ ! -f /usr/bin/sshpass ]; then
NEEDRESTART_MODE=l apt -y install sshpass
fi
if [ ! -f /usr/bin/fzy ]; then
NEEDRESTART_MODE=l apt -y install fzy
fi
if [ ! -f /usr/bin/borg ]; then
NEEDRESTART_MODE=l apt -y install borgbackup
fi
@Wqrld
Wqrld / discord_member_analysis.ipynb
Created April 27, 2023 11:16
discord_member_analysis
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
select SUM(amount) sum,DATE_FORMAT(STR_TO_DATE(date, '%d-%m-%Y %H:%i'), '%d-%m-%Y') as d
from Payments
WHERE (state = 'approved' or state = 'paid') and client != 1
group by d
order by sum DESC;
bash -c 'for ((i=1; i < 7; ++i)); do curl "https://api.github.com/users/Wqrld/starred?page=0&per_page=100" | jq .[].ssh_url; done' | sed 's/"//g' | xargs -L1 git clone
@Wqrld
Wqrld / mask.java
Created March 6, 2023 09:32
Subnet masks in java
public class Main {
public static void main(String[] args) {
int binary = 0x00;
for (int i = 0; i <= 32; i++) {
System.out.printf("%d.%d.%d.%d (/%d)%n", (binary >> 24) & 0xFF, (binary >> 16) & 0xFF, (binary >> 8) & 0xFF, binary & 0xFF, i);
binary >>= 1;
binary |= (1 << 31);
}
}
}
select sum(amount) as sum,username from Payments
JOIN Users on Users.id = Payments.client
where state = 'paid' OR state = 'approved'
group by username
order by sum desc
limit 50;
@Wqrld
Wqrld / libssl.md
Created February 6, 2023 09:03
mongodb libssl 22.04

wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb

dpkg -i libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb

and continue installing mongo

// DEV
boolean read = false;
while(!read) {
System.out.print((char) 27 + "[?1000h"); // enable mouse trap
try {
byte[] in = System.in.readNBytes(6);
StringBuilder sb = new StringBuilder();
if(in.length > 0) {
if(in[4] == ' ') {
System.out.println("down");
@Wqrld
Wqrld / churn.sql
Last active January 3, 2023 15:10
Some useful SQL stats (data-science-esque)
SELECT paymentcount, CONCAT(ROUND(((cnt - lag(cnt) over (ORDER BY paymentcount)) / lag(cnt) over (ORDER BY paymentcount)) * 100), '%')
as perc_change, cnt as cnt
from (SELECT COUNT(paymentcount) as cnt,paymentcount FROM
(select COUNT(*) as paymentcount From Payments JOIN Users on Users.id = Payments.client
where Users.id != 1 GROUP BY Users.id)
as a group by paymentcount) as b