Skip to content

Instantly share code, notes, and snippets.

@trungv0
trungv0 / query.py
Created October 13, 2023 15:40
frosty friday w066
# https://frostyfriday.org/blog/2023/10/06/week-66-intermediate/
import snowflake.snowpark as snowpark
from snowflake.snowpark import functions as F
def main(session: snowpark.Session):
tableName = 'snowflake.account_usage.tables'
dataframe = (
session.table(tableName)
.filter(
(F.col('row_count') > 0)
name: "ResNet-101"
input: "data"
input_shape{
dim: 1
dim: 3
dim: 224
dim: 224
}
input: "rois"
@trungv0
trungv0 / install.sh
Last active April 7, 2016 08:54
MongoDB Replica
rpm --import https://www.mongodb.org/static/pgp/server-3.2.asc
cat > /etc/yum.repos.d/mongodb-org-3.2.repo << EOF
[mongodb-org-3.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc
EOF
@trungv0
trungv0 / haproxy.sh
Last active April 29, 2024 14:54
RabbitMQ cluster with HAProxy & Keepalived for high availability
# install haproxy
yum install -y haproxy
# config haproxy for rabbitmq
cat > /etc/haproxy/haproxy.cfg << "EOF"
global
log 127.0.0.1 local0 notice
maxconn 10000
user haproxy
@trungv0
trungv0 / sample_stock_messages.js
Created October 13, 2015 05:11
Sample stock messages
var util = require('util');
var stocks = ['AAA','ACB','ADC','ALT','ALV','AMC','AME','AMV','APG','API','APP','APS','ARM','ASA','B82','BAM','BBS','BCC','BDB','BED','BHT','BII','BKC','BLF','BPC','BSC','BST','BTS','BVS','BXH','C92','CAN','CAP','CCM','CEO','CID','CJC','CKV','CMC','CMI','CMS','CPC','CSC','CT6','CTA','CTB','CTC','CTN','CTS','CTX','CVN','CVT','CX8','D11','DAC','DAD','DAE','DBC','DBT','DC2','DC4','DCS','DGC','DHP','DHT','DID','DIH','DL1','DLR','DNC','DNM','DNP','DNY','DPC','DST','DXP','DZM','EBS','ECI','EFI','EID','FDT','FIT','GGG','GLT','GMX','HAD','HAT','HBE','HBS','HCC','HCT','HDA','HDO','HEV','HGM','HHC','HHG','HJS','HLC','HLD','HLY','HMH','HNM','HOM','HPC','HPS','HST','HTC','HTP','HUT','HVT','ICG','IDJ','IDV','INC','INN','ITQ','IVS','KHB','KHL','KKC','KLF','KLS','KMT','KSD','KSK','KSQ','KST','KTS','KTT','L14','L18','L35','L43','L44','L61','L62','LAS','LBE','LCD','LCS','LDP','LHC','LIG','LM3','LM7','LO5','LTC','LUT','MAC','MCC','MCF','MCO','MDC','MEC','MHL','MIM','MKV','MMC','MNC','NAG','NBC','NB
@trungv0
trungv0 / auto-format.js
Last active August 29, 2015 14:26
Format HTML input on the fly (require jQuery)
$container.on('keyup', '.auto-formatted', function(e) {
var val = $(this).val();
var pureVal = parseFloat(util.unformat(val));
if (isValid(pureVal)) { // isNaN if number
$(this).data('val', defaultVal); // 0 if number
return;
}
$(this).data('val', pureVal);
var newVal = util.format(pureVal);
@trungv0
trungv0 / Preferences.sublime-settings
Last active August 29, 2015 14:22
sublime settings
{
"default_line_ending": "unix",
"ensure_newline_at_eof_on_save": true,
"font_size": 10,
"ignored_packages":
[
"Vintage"
],
"margin": 0,
"shift_tab_unindent": true,
@trungv0
trungv0 / Gemfile
Last active August 29, 2015 14:22
rspec rails
group :development, :test do
gem 'rspec-rails'
gem 'factory_girl_rails'
end
group :test do
gem 'faker'
gem 'capybara'
gem 'guard-rspec'
gem 'launchy'
@trungv0
trungv0 / Gemfile
Last active August 29, 2015 14:22
haml for rails
gem 'haml'
gem 'haml-rails' # for template generation
@trungv0
trungv0 / Gemfile.rb
Last active August 29, 2015 14:21
angular in rails
gem 'angularjs-rails'