Skip to content

Instantly share code, notes, and snippets.

🌈

Tenzin Chemi imechemi

🌈
Block or report user

Report or block imechemi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@imechemi
imechemi / Application.java
Created Nov 6, 2019
How to get ApplicationContext from Spring with Java config
View Application.java
public class Application {
public static void main(String[] args) {
ApplicationContext ctx = new AnnotationConfigApplicationContext(SOTelemetryDbConfig.class);
}
}
@imechemi
imechemi / Application.java
Created Nov 5, 2019
How to use Standalone MongoTemplate in Main class
View Application.java
@SpringBootApplication
public class Application implements CommandLineRunner {
@Autowired
private DeviceRepository deviceRepository;
public static void main(String[] args) {
SpringApplication.run(Application.class);
// MongoOperations mongoOps = new MongoTemplate(new SimpleMongoDbFactory(new MongoClient(), "test"));
// RepositoryFactorySupport repositoryFactorySupport = new MongoRepositoryFactory(mongoOps);
@imechemi
imechemi / prime_generator.rb
Created Jun 13, 2019
Object Oriented Prime Generator
View prime_generator.rb
class Prime
def initialize()
@value = 2
end
def value
@value
end
def next
View sublime_settings
{
"ensure_newline_at_eof_on_save": true,
"font_size": 13,
"ignored_packages":
[
"Vintage"
],
"line_padding_bottom": 1,
"line_padding_top": 1,
"rulers":
View gist:04a8d90cdf1083a2e1219210f985284e
{"timestamp":"2017-07-09T13:54:54Z","severity":"FATAL","type":"exception","message":"ActionController::RoutingError(No route matches [HEAD] \"/client-solution-configuration-service/meta/availability\"): vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'","exception_id":"d39ef109fc87cd75b225cce1ceb03e5ed2103d5c","class":"ActionController::RoutingError","backtrace":["vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'","vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'","vendor/bundle/ruby/2.2.0/gems/streetcar-logging-0.6.0/lib/streetcar/logging/middleware.rb:22:in `block in call'","vendor/bundle/ruby/2.2.0/gems/streetcar-logging-0.6.0/lib/streetcar/logging/middleware.rb:33:in `block in instrument'","vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in `block in instrument'","vendor/bundle/ruby/2
@imechemi
imechemi / error.log
Created Jul 11, 2017
This is the actual error log with PassengerLogLevel 7 and during incident time.
View error.log
[ 2017-07-09 08:55:01.1282 6743/7fb4a7f34700 Uti/ScopeGuard.h:113 ]: File descriptor closed: 66
[ 2017-07-09 08:55:01.1284 6743/7fb4a7f34700 App/Poo/AnalyticsCollection.cpp:71 ]: Analytics collection done; next analytics collection in 4.872 sec
[ 2017-07-09 08:55:02.0688 6743/7fb476bfd700 Ser/Server.h:241 ]: [ApiServer] New clients can be accepted on a server socket
[ 2017-07-09 08:55:02.0690 6743/7fb476bfd700 Ser/Server.h:363 ]: [ApiServer] Creating new client object
[ 2017-07-09 08:55:02.0690 6743/7fb476bfd700 Ser/Server.h:575 ]: [Client A2041] Client associated with file descriptor: 66
[ 2017-07-09 08:55:02.0690 6743/7fb476bfd700 Ser/Server.h:261 ]: File descriptor purpose: 66: Server ApiServer, client A2041
[ 2017-07-09 08:55:02.0691 6743/7fb476bfd700 Ser/Server.h:267 ]: [ApiServer] 1 new client(s) accepted; there are now 1 active client(s)
[ 2017-07-09 08:55:02.0691 6743/7fb476bfd700 Ser/HttpServer.h:668 ]: [Client A2041] Event: onClientAccepted
[ 2017-07-09 08:55:02.0691 6743/7fb476bfd700 Ser/HttpServer
@imechemi
imechemi / error.log
Created Mar 6, 2017
splunk-ruby-sdk `sysread_nonblock': end of file reached (EOFError)
View error.log
/usr/local/ruby/2.2.3/lib/ruby/2.2.0/openssl/buffering.rb:182:in `sysread_nonblock': end of file reached (EOFError)
from /usr/local/ruby/2.2.3/lib/ruby/2.2.0/openssl/buffering.rb:182:in `read_nonblock'
from /usr/local/ruby/2.2.3/lib/ruby/2.2.0/net/protocol.rb:153:in `rbuf_fill'
from /usr/local/ruby/2.2.3/lib/ruby/2.2.0/net/protocol.rb:134:in `readuntil'
from /usr/local/ruby/2.2.3/lib/ruby/2.2.0/net/protocol.rb:144:in `readline'
from /usr/local/ruby/2.2.3/lib/ruby/2.2.0/net/http/response.rb:39:in `read_status_line'
from /usr/local/ruby/2.2.3/lib/ruby/2.2.0/net/http/response.rb:28:in `read_new'
from /usr/local/ruby/2.2.3/lib/ruby/2.2.0/net/http.rb:1414:in `block in transport_request'
from /usr/local/ruby/2.2.3/lib/ruby/2.2.0/net/http.rb:1411:in `catch'
from /usr/local/ruby/2.2.3/lib/ruby/2.2.0/net/http.rb:1411:in `transport_request'
@imechemi
imechemi / fix-homebrew-npm.md
Created Oct 9, 2015 — forked from DanHerbert/fix-homebrew-npm.md
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew
View fix-homebrew-npm.md

Fixing npm On Mac OS X for Homebrew Users

If you just want to fix the issue quickly, scroll down to the "solution" section below.

Explanation of the issue

If you're a Homebrew user and you installed node via Homebrew, there is a major philosophical issue with the way Homebrew and NPM work together. If you install node with Homebrew and then try to do npm update npm -g, you may see an error like this:

$ npm update npm -g
@imechemi
imechemi / gist:87a46eb8547762ba7738
Last active Aug 29, 2015 — forked from rb2k/gist:8372402
A jenkins script to clean up workspaces on slaves
View gist:87a46eb8547762ba7738
// Check if a slave has < 10 GB of free space, wipe out workspaces if it does
import hudson.model.*;
import hudson.util.*;
import jenkins.model.*;
import hudson.FilePath.FileCallable;
import hudson.slaves.OfflineCause;
import hudson.node_monitors.*;
for (node in Jenkins.instance.nodes) {
You can’t perform that action at this time.