Skip to content

Instantly share code, notes, and snippets.

View yrsdi's full-sized avatar
👋
Hi

Yadi Rosadi yrsdi

👋
Hi
View GitHub Profile
@yrsdi
yrsdi / c_cpp_properties.json
Created November 23, 2018 11:12 — forked from seanwu1105/c_cpp_properties.json
The default c_cpp_properties.json for Visual Studio Code
{
"configurations": [
{
"name": "Mac",
"includePath": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"defines": [],
@yrsdi
yrsdi / setup_go.md
Created October 22, 2018 17:35 — forked from rubencaro/setup_go.md
Setting up a polite Golang project

Setting up a polite Golang project

By polite I mean not interfering in any other projects (even Golang ones), not polluting or forcing your global workspace (no matter how it is organized), and being reproducible on any other machine. For reasons out of the scope of this document, that's not an easy task to accomplish when working with Golang.

These are my notes, not a generic solution. They are not meant to work anywhere outside my machines.

Installing everything needed the first time

Install asdf and its golang plugin, then install golang

@yrsdi
yrsdi / listAcc.erl
Last active October 8, 2018 23:30
List accumulators in Erlang based on Joe's Erlang book
-module (listAcc).
-compile(export_all).
%% Sources : https://stackoverflow.com/questions/22189296/list-accumulators-in-erlang
%% There are two functions - odds_and_evens_acc/1 and odds_and_evens_acc/3
%% First function. It takes a list of integers and splits it on two lists -
%% odds and evens.
%% The function calls odds_and_evens_acc/3 with three arguments -
%% given List of integers and two empty lists which are
@yrsdi
yrsdi / README.md
Last active June 11, 2020 03:23 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet
@yrsdi
yrsdi / mysql - kill all sleeping connections
Created September 13, 2018 06:14 — forked from lucashungaro/mysql - kill all sleeping connections
MySQL - kill command for all idle queries
SELECT GROUP_CONCAT('kill ',id SEPARATOR '; ') AS kill_list
FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE command='Sleep';
#!/bin/bash
set -e
set -u
PSQL=/usr/bin/psql
DB_USER=postgres
DB_HOST=0.0.0.0
DB_NAME=name_of_db
@yrsdi
yrsdi / git_cheat-sheet.md
Created September 5, 2018 21:39 — forked from davfre/git_cheat-sheet.md
git commandline cheat-sheet
@yrsdi
yrsdi / mysql_export_csv.sql
Last active September 28, 2018 02:35
export mysql data to csv on cli
-- export mysql data to csv with header
select 'created_date','disk_space_100','disk_space_101','disk_space_116','disk_space_117'
union all (select created_date, disk_space_100, disk_space_101, disk_space_116,disk_space_117
from bdc_tibco_diskSpace where date_format(created_date, '%Y-%m')='2018-08'
into outfile '/var/lib/mysql/data/tibco_disk_space.csv'
fields terminated by ','
enclosed by '"'
lines terminated by '\n')
@yrsdi
yrsdi / scp_file.sh
Last active September 5, 2018 02:34
Copy file between 2 server
#!/bin/bash
dateNow=$(date -d "-1 days" +"%Y%m%d");
REMOTE_IP='10.0.0.0'
SCP_PASSWORD="pas1212121"
SCP_DIR="/var/www/html/"
SCP_FILE="NAMEOFFILE-$dateNow.txt"
SCP_REMOTE="username@$REMOTE_IP:$SCP_DIR/$SCP_FILE"
TARGET_IP='10.0.0.1'
TARGET_SCP_PASSWORD='pas12121212'
@yrsdi
yrsdi / create-mysql.bash
Created August 29, 2018 03:27 — forked from omeinusch/create-mysql.bash
Simple bash script to create mysql db, user with generated password
#!/bin/bash
PASS=`pwgen -s 40 1`
mysql -uroot <<MYSQL_SCRIPT
CREATE DATABASE $1;
CREATE USER '$1'@'localhost' IDENTIFIED BY '$PASS';
GRANT ALL PRIVILEGES ON $1.* TO '$1'@'localhost';
FLUSH PRIVILEGES;
MYSQL_SCRIPT