This file contains hidden or 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
require 'open-uri' | |
url = 'https://gist.githubusercontent.com/FlowerWrong/bccee4d63a6f0542523074f2ae184094/raw/131d8508d12f5a995524d07a3c45aa21495afd21/smart-config.txt' | |
open(url).each_line do |row| | |
arr = row.split(' ') | |
if arr[0] == 'direct_domain' | |
arr.each_with_index do |domain, i| | |
if i == 0 | |
next | |
end |
This file contains hidden or 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
local binanceVETMenubar = hs.menubar.new() | |
BINANCE_URL = 'https://fapi.binance.com' | |
SYMBOL = 'VETUSDT' | |
local url = BINANCE_URL .. "/fapi/v1/ticker/price?symbol=" .. SYMBOL | |
local vetPrices = {} | |
-------------------------------------------------------------------------------- | |
-- splicing: remove elements from a table |
This file contains hidden or 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
# demo code | |
import plotly.express as px | |
import plotly.io as pio | |
import akshare as ak | |
pio.templates.default = "none" | |
df = ak.stock_us_daily(symbol='AAPL', adjust='qfq') | |
df = df.loc['2015-01-01':'2022-01-01'] | |
df = df.reset_index() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
ps axo rss,comm,pid \ | |
| awk '{ proc_list[$2] += $1; } END \ | |
{ for (proc in proc_list) { printf("%d\t%s\n", proc_list[proc],proc); }}' \ | |
| sort -n | tail -n 10 | sort -rn \ | |
| awk '{$1/=1024;printf "%.0fMB\t",$1}{print $2}' |
This file contains hidden or 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
// https://develop.sentry.dev/self-hosted/ | |
// https://github.com/getsentry/onpremise | |
git clone [email protected]:getsentry/onpremise.git | |
cd onpremise | |
./install.sh | |
docker-compose up -d |
This file contains hidden or 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
require("@rails/ujs").start() | |
require("turbolinks").start() | |
require("@rails/activestorage").start() | |
require("channels") | |
import $ from "jquery" // yarn add jquery | |
// yarn add gridstack | |
import "gridstack/dist/jq/jquery-ui" | |
import 'gridstack/dist/gridstack-poly'; // optional IE support |
This file contains hidden or 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
# rails g model ChinaRegion name parent_id lng lat | |
class AddChinaRegionData < ActiveRecord::Migration[6.0] | |
def up | |
# https://github.com/pfinal/city | |
ChinaRegion.destroy_all | |
ActiveRecord::Base.connection.reset_pk_sequence!(ChinaRegion.table_name) | |
data = [] | |
File.open(Rails.root.join('db', 'data', 'region.txt')).each do |line| | |
next unless /\((.*)\).*/ =~ line |
This file contains hidden or 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
# frozen_string_literal: true | |
class FileAdapter | |
include ElasticAPM::Logging | |
def initialize(config) | |
@config = config | |
@mutex = Mutex.new | |
@logger_file = File.new('log/apm.log', 'a+') |
NewerOlder