This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Still a work in progress but is good enough for development | |
# | |
# `rake redmine:demo_data` for it all | |
# `rake redmine:demo_data:users` | |
# `rake redmine:demo_data:projects` | |
# `rake redmine:demo_data:issues` | |
# `rake redmine:demo_data:time_entries` | |
require "faker" | |
require "random_data" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TRUNCATE TABLE `db`.`table`; | |
LOAD DATA LOCAL INFILE '/home/ubuntu/file.csv' IGNORE INTO TABLE `db`.`table` | |
FIELDS TERMINATED BY ',' | |
OPTIONALLY ENCLOSED BY '"' ESCAPED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES (`id`, `Name`, | |
`Status`, `AccountNumber`, @v1, | |
@v2, `Business_Street`) | |
SET Formation_Date = STR_TO_DATE(@v1,'%m/%d/%Y'), | |
Production_Date = STR_TO_DATE(@v2,'%m/%d/%Y'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
wget -qO- http://acosonic.com/ip.php && echo -e "\r" | |
#you can use shc and compile this like shc -vrf pubip.sh -o pubip && mv pubip ~/bin | |
#then just use it as pubip from anywhere or move to system bin... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo 1 > /sys/block/sda/device/rescan | |
cfdisk /dev/sda | |
pvresize /dev/sda3 | |
lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv | |
resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
apt install memcached libmemcached-tools | |
systemctl status memcached | |
echo stats | nc 127.0.0.1 11211 | |
apt install php-memcached | |
phpenmod memcached | |
apache2ctl restart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
LANG=en_US.UTF-8 snap list --all | awk '/disabled/{print $1, $3}' | | |
while read pkg revision; do | |
sudo snap remove "$pkg" --revision="$revision" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER TABLE somename ADD id int NOT NULL AUTO_INCREMENT primary key first |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#change the exit criteria 61564999 to fit your needs | |
CREATE DEFINER=`root`@`localhost` PROCEDURE `adduuid`() | |
LANGUAGE SQL | |
NOT DETERMINISTIC | |
CONTAINS SQL | |
SQL SECURITY DEFINER | |
COMMENT '' | |
BEGIN | |
DECLARE a INT Default 1 ; | |
simple_loop: LOOP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assuming your sql has this global var set or you can set it via additional query: | |
// set global local_infile=true; | |
const mysql = require('mysql'); // or use import if you use TS | |
const util = require('util'); | |
const fs = require("fs"); | |
const conn = mysql.createConnection({ | |
host: "localhost", | |
user: "root", | |
password: "pw", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE mytable SET uuid=(LOWER(CONCAT( | |
LPAD(HEX(ROUND(rand()*POW(2,32))), 8, '0'), '-', | |
LPAD(HEX(ROUND(rand()*POW(2,16))), 4, '0'), '-', | |
LPAD(HEX(ROUND(rand()*POW(2,16))), 4, '0'), '-', | |
LPAD(HEX(ROUND(rand()*POW(2,16))), 4, '0'), '-', | |
LPAD(HEX(ROUND(rand()*POW(2,48))), 12, '0') | |
))); |
NewerOlder