Skip to content

Instantly share code, notes, and snippets.

💭
Busy
I may be slow to respond.

Nate Berkopec nateberkopec

View GitHub Profile
@nateberkopec
nateberkopec / thread.diff
Created Feb 14, 2019
thread quantum patch
View thread.diff
diff --git a/thread_pthread.c b/thread_pthread.c
index d8d3184c62..4e28b9a31d 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -175,7 +175,7 @@ static const void *const condattr_monotonic = NULL;
/* 100ms. 10ms is too small for user level thread scheduling
* on recent Linux (tested on 2.6.35)
*/
-#define TIME_QUANTUM_MSEC (100)
+#define TIME_QUANTUM_MSEC (10)
@nateberkopec
nateberkopec / correction.md
Last active Jan 16, 2019
A Simple Correction
View correction.md

In yesterday's post I said, in relation to "how does .present? work on ActiveRecord::Relation", I said that present? performs an existence check SELECT 1 AS one FROM ... LIMIT 1 because it calls exists? underneath. This is actually wrong - it loads the relation.

Jonathan Mast corrected me on Twitter. It turns out, I should have paid closer attention! Here is the actual implementation of blank? on ActiveRecord::Relation on Rails master:

# Returns true if relation is blank.
def blank?
  records.blank?
end
View presenttest.rb
ActiveRecord::Base.logger = Logger.new(STDOUT)
MODEL = User # enter a model that exists in your app here
users = MODEL.all
puts "users.present?"
users.present?
users = nil
users = MODEL.all
puts "users.empty?"
@nateberkopec
nateberkopec / hide_or_display_index.js
Last active Dec 3, 2018
Hide gmail inbox when empty, v0.1
View hide_or_display_index.js
// ==UserScript==
// @name Gmail Inbox Empty Reward
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Hides much of the Gmail UI when your inbox is empty, to give you a little reward for reaching Inbox Zero!
// @author Nate Berkopec
// @include http://mail.google.com/*
// @include https://mail.google.com/*
// @include http://*.mail.google.com/*
// @include https://*.mail.google.com/*
@nateberkopec
nateberkopec / repro_script.rb
Created Aug 14, 2017
Sentry repro script for rails
View repro_script.rb
# frozen_string_literal: true
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
@nateberkopec
nateberkopec / resume.txt
Created Aug 7, 2017
Mohammed Elias Al-Hussein - Resume
View resume.txt
____________________________________________________________
PERSONAL INFORMATION
Mohammed Elias Alhussein
Istanbul , Turkey
+ 90 5312303185
eliass.alhusain@gmail.com
Gender : Male | Date of birth 1/1/1993 | Nationality Syrian
WORK EXPERIENCE
2015 - 2016 Member of a software Developer Team
View console.rb
require 'krpc'
CLIENT_NAME = "Console"
HOST_IP = "192.168.1.13"
$client = KRPC::Client.new(name: CLIENT_NAME, host: HOST_IP).connect!
binding.pry
@nateberkopec
nateberkopec / test.rb
Created Jul 31, 2017
KRPC - test rocket script
View test.rb
require 'krpc'
CLIENT_NAME = "Flight Computer"
MISSION_NAME = "UPPER STAGE TEST"
HOST_IP = "192.168.1.13"
KRPC_CMD_WAIT = 0.01
SPOOL_TO_THRUST_PERCENT = 0.25
$client = KRPC::Client.new(name: CLIENT_NAME, host: HOST_IP).connect!
View mohammed-signed.md

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256


layout: post title: "How To Get A Computer Science Degree in a Warzone" date: 2017-08-10 7:00:00 summary: "An appeal to any Canadian readers or friends of mine to help one of our own: a young computer programmer fleeing the Syrian Civil War." readtime: "2580 words/12 minutes"


View keybase.md

Keybase proof

I hereby claim:

  • I am nateberkopec on github.
  • I am nateberkopec (https://keybase.io/nateberkopec) on keybase.
  • I have a public key ASCNxGGomrAYwaFCor0xa9ATHG3YaMR_K8r_22uBOVfAwgo

To claim this, I am signing this object:

You can’t perform that action at this time.