Skip to content

Instantly share code, notes, and snippets.

View happythenewsad's full-sized avatar

happythenewsad

  • USA
View GitHub Profile
@happythenewsad
happythenewsad / worker.js
Created December 19, 2024 01:14
Example Cloudflare healthcheck worker with deep HTTP inspection
const YOUR_SLACK_WEBHOOK = "";
const HEALTH_CHECK_TARGET = "";
async function notify(text) {
return fetch(YOUR_SLACK_WEBHOOK, {
method: "POST",
body: JSON.stringify({
text
}),
headers: {
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
diff --git a/packages/ui/error-boundary.tsx b/packages/ui/error-boundary.tsx
index 626f574..81a69bb 100644
--- a/packages/ui/error-boundary.tsx
+++ b/packages/ui/error-boundary.tsx
@@ -38,10 +38,7 @@ class ErrorBoundary extends Component<Props, State> {
const eventId = this.state.eventId as any;
return (
<>
- <Button onClick={() => Sentry.showReportDialog({ eventId })}>
- Report feedback
Traceback (most recent call last):
File "twitter_features_test.py", line 28, in <module>
tagged_tweets = TwitterParser.tag(example_tweets)
File "/Users/peterkong/local/penn/530/530project/feature-extraction/twitter-features/TwitterParser.py", line 18, in tag
output = str(subprocess.check_output(cmd, stderr=FNULL))
File "/Users/peterkong/miniconda3/lib/python3.6/subprocess.py", line 336, in check_output
**kwargs).stdout
File "/Users/peterkong/miniconda3/lib/python3.6/subprocess.py", line 418, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/Users/peterkong/local/penn/530/530project/feature-extraction/twitter-features/ark-tweet-nlp/runTagger.sh', '/Users/peterkong/local/penn/530/530project/feature-extraction/twitter-features/tweets.txt']' returned non-zero exit status 1.
void print_ether(struct ether_header *eptr){
printf("Ether: type: %s", eth_type_to_s(eptr->ether_type));
printf(" src: %02X:%02X:%02X:%02X:%02X:%02X",
eptr->ether_shost[0],
eptr->ether_shost[1],
eptr->ether_shost[2],
eptr->ether_shost[3],
eptr->ether_shost[4],
eptr->ether_shost[5]);
@happythenewsad
happythenewsad / gist:11359083
Created April 28, 2014 00:42
tf idf vectorizer problem
vectorizer = TfidfVectorizer( stop_words='english')
vectorizer.fit_transform([ARRAY_OF_STRINGS])
xtest = vectorizer.fit_transform(["the quick brown fox", "jumped over the lazy dog"])
model = RandomForestClassifier(n_estimators=10)
print np.exp(model.predict_proba(xtest.toarray()))
# ValueError: Number of features of the model must match the input. Model n_features is 10070 and input n_features is 3
@happythenewsad
happythenewsad / gist:2029269
Created March 13, 2012 14:55
adding class methods and instance methods from models
module Foo
module ClassMethods
def find(params = nil)
puts "\"find\" called, with context = #{self}"
end
end
def self.included(klass)
klass.extend ClassMethods
end
[first_arg, everything_else... ] = ['a','quick','brown','fox']
console.log first_arg
console.log everything_else
#=> a
#=> [ 'quick', 'brown', 'fox' ]
require 'spec_helper'
require 'factory_girl'
FactoryGirl.find_definitions #stops execution here
#ajax_test.js.rjs:
page.replace_html('foobar', "hi this is ajax from ajax test!")
#posts_controller.rb:
class PostsController < ApplicationController
def ajax_test
respond_to do |format|
format.js