Skip to content

Instantly share code, notes, and snippets.

View SalGnt's full-sized avatar

Salvatore Gentile SalGnt

View GitHub Profile
@iKlsR
iKlsR / x86_x64_asm_build.sublime-build
Created December 19, 2012 20:42
x86_64 assembly build system for sublime text 2
{
"cmd": ["nasm", "-f", "bin", "${file}", "-o", "${file_path}/${file_base_name}.COM"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}"
}
// syntax for cmdline building : http://www.nasm.us/xdoc/2.10.06/html/nasmdoc2.html#section-2.1
// syntax for sublime build system : http://sublimetext.info/docs/en/reference/build_systems.html (outdated)?
// replace nasm and update switches as needed.. ;ie.. fasm etc
// ${file} refers to the current saved file.. ${file_path} etc..
@carlok
carlok / istat.sql
Last active January 21, 2022 10:18
Script SQL per la memorizzazione dei Comuni, delle Province e delle Regioni d’Italia: usare la nuova versione su https://github.com/carlok/comuni_sql
---
--- Usare la nuova versione su https://github.com/carlok/comuni_sql
---
CREATE TABLE IF NOT EXISTS regioni (
id int(11) NOT NULL auto_increment,
nome varchar(100) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@goshacmd
goshacmd / fix_sys_rb.sh
Created June 12, 2013 07:41
OS X [REDACTED] Ruby 2.0 headers fix.
sys_rb_usr=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr
sdk_rb_usr=`xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr
sudo cp -r $sdk_rb_usr/include $sys_rb_usr/include
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active March 27, 2025 08:16
A badass list of frontend development resources I collected over time.
@rpocklin
rpocklin / responsive-mixin.sass
Last active December 23, 2015 21:09
SASS 3.2 Mixin for easy responsive declarations (break-points) Uses the best of SASS variables and @each to simply define break-points in a more natural language.
/* responsive break points - customise to suit or add more */
$break-small: 480px;
$break-medium: 768px;
$break-large: 940px;
$break-x-large: 1140px;
/* how to use:
@include devices(mobile) { - targets a single device
body {
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns                     on recent CPU
L2 cache reference ........................... 7 ns                     14x L1 cache
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns                     20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs 4X memory

@julianshapiro
julianshapiro / IE.js
Last active May 11, 2024 15:22
Future-Proof IE Version Detection Without User Agent Sniffing
var IE = (function() {
if (document.documentMode) {
return document.documentMode;
} else {
for (var i = 7; i > 4; i--) {
var div = document.createElement("div");
div.innerHTML = "<!--[if IE " + i + "]><span></span><![endif]-->";
if (div.getElementsByTagName("span").length) {
@emad-elsaid
emad-elsaid / irc-bot.rb
Created March 2, 2014 11:47
Wikipedia IRC bot
#!/usr/bin/env ruby
require 'cinch' # gem install cinch --no-ri --no-rdoc
require 'askwiki' # gem install askwiki --no-ri --no-rdoc
bot = Cinch::Bot.new do
configure do |c|
c.server = "irc.freenode.org"
c.nick = "Ask_wikipedia"
c.channels = ["#cinch-bots"]
@staltz
staltz / introrx.md
Last active April 6, 2025 09:15
The introduction to Reactive Programming you've been missing