Skip to content

Instantly share code, notes, and snippets.

View CyJimmy264's full-sized avatar
💚

Maksim Veynberg CyJimmy264

💚
View GitHub Profile
@CyJimmy264
CyJimmy264 / drop_tables
Created September 24, 2014 07:15
Drop all tables that start with some prefix
SELECT
CONCAT(
"DROP TABLE ",
GROUP_CONCAT(
CONCAT(TABLE_NAME, "\n")
)
) AS stmt
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = "DatabaseName" AND TABLE_NAME LIKE "prefix_%"
@CyJimmy264
CyJimmy264 / rtl8723ae.conf
Created November 24, 2017 18:53
wifi module options (dir: /etc/modprobe.d/)
options rtl8723ae swenc=1 fwlps=0
# ips=0 msi=0 swlps=0
# from sysfsutils:
# systool -a -v -m rtl8723ae | grep -A8 "Parameters:"
@CyJimmy264
CyJimmy264 / .gitconfig
Created December 6, 2017 10:38
.gitconfig [credential]
[credential]
helper = cache --socket=$XDG_RUNTIME_DIR/git/credentials/socket.$XDG_SESSION_ID --timeout=2592000
@CyJimmy264
CyJimmy264 / v8js.sh
Created January 18, 2018 11:48 — forked from igez/v8js.sh
Install V8js php extension on ubuntu
#!/bin/bash
sudo apt-get update -o Acquire::ForceIPv4=true
sudo apt-get install -y build-essential chrpath git -o Acquire::ForceIPv4=true
cd /tmp
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=`pwd`/depot_tools:"$PATH"
@CyJimmy264
CyJimmy264 / screenlapser.sh
Created March 9, 2018 10:25
Screenlapser with scrot and mencoder
#!/usr/bin/env zsh
write_avi() {
mencoder -ovc x264 -mf w=1400:h=900:fps=20:type=jpg \
"mf://@screenlapser-$atimeout.txt" \
-o screenlapse-`date +%Y-%m-%d-%H-%M-%S`.avi
xargs rm < screenlapser-$atimeout.txt
rm screenlapser-$atimeout.txt
}
trap 'atimeout=$timeout; write_avi; trap - INT; kill -INT $$' INT
@CyJimmy264
CyJimmy264 / openssl_files_encrypt_decrypt.sh
Created June 7, 2018 06:18
openssl files encrypt/decrypt
##########################
# Small files
##########################
# convert pub key to pem.pub format
ssh-keygen -f ~/.ssh/id_rsa.pub -e -m PKCS8 > id_rsa.pem.pub
# inverse
ssh-keygen -f id_rsa.pem.pub -i -m PKCS8
# encrypt small files
@CyJimmy264
CyJimmy264 / gpg-import-and-export-instructions.md
Created June 14, 2018 08:32 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

-----BEGIN PGP MESSAGE-----
jA0EBwMC01NY0ljQi7Fg0trGAbvlSymD7zAzubYEj8HNuDcgFalgVbM01obWeYwd
CmVEJiE4rIkicz8FDMgTkZNw+7Lnxr8RryWXXkdvv/ujL05XiWbHPedgbq92AaEO
PbF6F3PtN9+Qo1NIYeFbR82UdvLiWweygqn0o5sYIRqaEnbgwF5Mfl2YuS1PVyZs
j9tgXaSTDK+o1k9d4qOmSwbEhA/3K93e09PwHHGL/3z/VA1kMFD2GnV1P6VRK8ap
6SVNQQqhR2HkIdcHcop8JQzOE8CQKRe97BPyO7dkN9JTbLCXABGMtAl8jiK5vQzZ
wbhUT9qCK5HhaOSd4eIH3h8JhGiOZ2pf2kY+eh26tWwp12JE7Q7LZRJGPtU4I7Jp
o/Jxu74Oq6bdqRjRmMGM3GaxWkYc+MKFmsHlpJW0oh/kCt+pZPtg7M4coMTk7w/d
pC1ZR7taEKy8CRMssOlhJkClpDx88MhRMWySURYGavAbqCJyU+UhkxLCqUn6YA+P
mkdir -p .vnc && echo '<VNCPas>' | vncpasswd -f > .vnc/passwd && chmod 0600 .vnc/passwd && vncserver && sleep 15 && vncserver -kill :1 && { cat <<EOF > .vnc/xstartup
#!/bin/bash
xrdb $HOME/.Xresources
exec startfluxbox
EOF
} && chmod +x .vnc/xstartup && _ loginctl enable-linger <username> && { _ bash -c "cat > /etc/systemd/system/vncserver@:1.service" << EOF
[Unit]
Description=Start TigerVNC server at startup
After=syslog.target network.target
@CyJimmy264
CyJimmy264 / exchange.rb
Last active November 25, 2022 07:17
cryptoexchange usage example
#!/usr/bin/env ruby
require 'cryptoexchange'
require 'ruby-progressbar'
require 'awesome_print'
require 'logger'
require 'pry'
class App
MARKETS = %w[bitmax cex]