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
#!/bin/sh | |
echo | |
echo "Uninstalling LabTech." | |
# If the agent is up, kill it | |
ps -ef | grep LTAgentMonitor | grep -v grep | awk '{print $2}' | xargs kill 2>/dev/null | |
ps -ef | grep LTLinuxAgent | grep -v grep | awk '{print $2}' | xargs kill 2>/dev/null | |
ps -ef | grep LTSystray | grep -v grep | awk '{print $2}' | xargs kill 2>/dev/null |
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
#!/bin/sh | |
SENTRY_KEY= | |
SENTRY_SECRET= | |
SENTRY_PROJECTID=1 | |
SENTRY_HOST=sentry.example.com | |
SCRIPT_ARGUMENTS=$@ | |
capture_error() | |
{ |
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
-- Gets all queries for a given date range | |
select starttime, endtime, trim(querytxt) as query | |
from stl_query | |
where starttime between '2014-11-04' and '2014-11-05' | |
order by starttime desc; | |
-- Gets all queries that have been aborted for a given date range | |
select starttime, endtime, trim(querytxt) as query, aborted | |
from stl_query | |
where aborted=1 |
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
#!/bin/bash | |
# Bonjour name ending in .local | |
scutil --set LocalHostName "My-iMac" | |
# Friendly name shown in System Preferences > Sharing | |
scutil --set ComputerName "My-iMac" | |
# The name recognized by the hostname command | |
scutil --set HostName "My-iMac" | |
# Save the computer's serial number in a variable so it can be used in the next command. | |
serialNum=$(ioreg -l | awk '/IOPlatformSerialNumber/ { split($0, line, "\""); printf("%s\n", line[4]); }') | |
# Set the NetBIOS name as the serial number |
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 "active_record" | |
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:") | |
ActiveRecord::Migration.class_eval do | |
create_table(:records) do |t| | |
t.string :column | |
end | |
end | |
data = 50_000.times.map { |i| Hash[column: "Column #{i}"] } |
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://stackoverflow.com/a/43819672/3321356 | |
# Define some required dependencies | |
require "bundler/inline" | |
gemfile(false) do | |
source "https://rubygems.org" | |
gem "activerecord", "~> 4.2.8" | |
gem "sqlite3" | |
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
// | |
// utf8.c | |
// training | |
// | |
// Created by Conrad Kleinespel on 5/27/13. | |
// Copyright (c) 2013 Conrad Kleinespel. All rights reserved. | |
// | |
#include <stdio.h> | |
#include <stdlib.h> |
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
/* | |
The code below shows how to encrypt and then decrypt some plaintext into a cyphertext using | |
KMS's Encrypt/Decrypt functions and secretbox (https://godoc.org/golang.org/x/crypto/nacl/secretbox). | |
The plaintext message is sealed into a secretbox using a key that is generated by kmsClient.GenerateDataKey(). | |
Note that this procedure reuquires that a master key would *already exist in KMS* and that its arn/alias is specified. | |
The aws library assumes that the proper credentials can be found in the shared file (~/.aws/credentials) | |
and opts for the 'default' role. | |
Once sealed, the cyphertext is then unboxed, again by first getting the key from kms (kmsClient.Decrypt), |
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
//发送get请求 | |
func get(url string) string { | |
response, err := http.Get(url) | |
if err != nil { | |
fmt.Printf("%s", err) | |
os.Exit(1) | |
} else { | |
defer response.Body.Close() | |
contents, err := ioutil.ReadAll(response.Body) | |
if err != nil { |
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
//发送get请求 | |
func get(url string) string { | |
response, err := http.Get(url) | |
if err != nil { | |
fmt.Printf("%s", err) | |
os.Exit(1) | |
} else { | |
defer response.Body.Close() | |
contents, err := ioutil.ReadAll(response.Body) | |
if err != nil { |